@restregular/dsh-powerup 0.19.14 → 0.19.16

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/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.14';
101
+ const VERSION = '0.19.15';
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. */
@@ -143,6 +143,10 @@
143
143
  'page.themeBrief': '在侧边栏点一下图标,在亮色与暗色之间切换。',
144
144
  'page.themeDesc': '在左侧边栏的品牌行加入一个主题切换按钮:点击即在亮色和暗色之间切换,图标随当前配色显示(暗色显示太阳,亮色显示月亮)。主题偏好交给 DSH 自身的主题服务保存,与系统设置里的「外观」保持一致。',
145
145
  'page.themeHow': '启用本功能后,左侧边栏顶部品牌名旁会出现一个太阳/月亮图标,点击即可切换亮暗模式;关闭本功能后按钮消失,主题设置仍由 DSH 管理。',
146
+ 'page.themeSystemLabel': '同时切换操作系统主题',
147
+ 'page.themeSystemHint': '开启后点击按钮会连同 Windows 的系统亮暗模式一起切换;仅 Windows 桌面版生效,其余环境仅切换 DSH 主题。',
148
+ 'theme.osApplied': '已同时切换系统主题',
149
+ 'theme.osFailed': '系统主题切换失败,仅切换了 DSH 主题',
146
150
  'theme.toLight': '切换到亮色模式',
147
151
  'theme.toDark': '切换到暗色模式',
148
152
  'page.actions': '可用操作',
@@ -579,6 +583,10 @@
579
583
  'page.themeBrief': 'Toggle light and dark mode from a sidebar button.',
580
584
  '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
585
  '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.',
586
+ 'page.themeSystemLabel': 'Also switch the operating system theme',
587
+ 'page.themeSystemHint': 'When on, clicking the button also flips the Windows system light/dark mode; Windows desktop only, other environments still switch the DSH theme.',
588
+ 'theme.osApplied': 'System theme switched too',
589
+ 'theme.osFailed': 'Could not switch the system theme; only the DSH theme changed',
582
590
  'theme.toLight': 'Switch to light mode',
583
591
  'theme.toDark': 'Switch to dark mode',
584
592
  'page.actions': 'What you can do',
@@ -1020,6 +1028,7 @@
1020
1028
  locateSession: true,
1021
1029
  scrollToTop: true,
1022
1030
  themeToggle: true,
1031
+ themeToggleSystem: false,
1023
1032
  contentRendering: true,
1024
1033
  dualSend: false,
1025
1034
  workspacePrompts: true,
@@ -1048,6 +1057,7 @@
1048
1057
  locateSession: parsed.locateSession !== false,
1049
1058
  scrollToTop: parsed.scrollToTop !== false,
1050
1059
  themeToggle: parsed.themeToggle !== false,
1060
+ themeToggleSystem: parsed.themeToggleSystem === true,
1051
1061
  contentRendering: parsed.contentRendering !== false,
1052
1062
  dualSend: parsed.dualSend === true,
1053
1063
  workspacePrompts: parsed.workspacePrompts !== false,
@@ -4259,7 +4269,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
4259
4269
  .dsh-powerup-card-body{margin-top:12px}
4260
4270
  .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}
4261
4271
  .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}
4272
+ .dsh-powerup-card-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:12px}
4263
4273
  .dsh-powerup-how-card .dsh-powerup-section-title{margin-bottom:10px}
4264
4274
  .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
4275
  .dsh-powerup-fold-btn:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-primary)}
@@ -5978,6 +5988,30 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
5978
5988
  return core;
5979
5989
  }
5980
5990
 
5991
+ /**
5992
+ * Standalone toast for installers outside the React tree (e.g. the theme
5993
+ * toggle). Reuses the overlay's toast class so it looks native.
5994
+ */
5995
+ let standaloneToast = null;
5996
+ function toastMessage(message) {
5997
+ if (typeof message !== 'string' || message === '' || !hasDocumentSafe()) return;
5998
+ if (standaloneToast !== null) standaloneToast.remove();
5999
+ const node = document.createElement('div');
6000
+ node.className = 'dsh-powerup-toast';
6001
+ node.setAttribute('role', 'status');
6002
+ node.textContent = message;
6003
+ document.body.appendChild(node);
6004
+ standaloneToast = node;
6005
+ setTimeout(() => {
6006
+ if (standaloneToast === node) standaloneToast = null;
6007
+ node.remove();
6008
+ }, 2400);
6009
+ }
6010
+
6011
+ function hasDocumentSafe() {
6012
+ return typeof document !== 'undefined' && document !== null && document.body !== null;
6013
+ }
6014
+
5981
6015
  /**
5982
6016
  * DOM controller for a theme toggle button in the sidebar brand row (the
5983
6017
  * logoRow that also holds the collapsed-rail toggle). It reads the theme
@@ -5985,7 +6019,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
5985
6019
  * showing a sun glyph in dark mode (click to go light) and a moon glyph in
5986
6020
  * light mode (click to go dark). Falls back to `prefers-color-scheme` via
5987
6021
  * the active theme's colorScheme when the preference is `system`.
5988
- * @param {{getTheme?: Function, setTheme?: Function, t?: Function, isEnabled?: Function}} deps
6022
+ * When `applySystem` is enabled, the click also asks the Host to flip the
6023
+ * operating system's light/dark mode and lets DSH follow the system.
6024
+ * @param {{getTheme?: Function, setTheme?: Function, t?: Function, isEnabled?: Function, applySystem?: Function, notify?: Function}} deps
5989
6025
  */
5990
6026
  function createThemeToggleCore(deps) {
5991
6027
  const options = deps ?? {};
@@ -5993,6 +6029,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
5993
6029
  const setTheme = typeof options.setTheme === 'function' ? options.setTheme : () => {};
5994
6030
  const t = typeof options.t === 'function' ? options.t : (key) => key;
5995
6031
  const isEnabled = typeof options.isEnabled === 'function' ? options.isEnabled : () => true;
6032
+ const applySystem = typeof options.applySystem === 'function' ? options.applySystem : () => Promise.resolve({ ok: false });
6033
+ const notify = typeof options.notify === 'function' ? options.notify : () => {};
5996
6034
 
5997
6035
  let button = null;
5998
6036
  let observer = null;
@@ -6057,7 +6095,24 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
6057
6095
  button.addEventListener('click', (event) => {
6058
6096
  event.preventDefault();
6059
6097
  event.stopPropagation();
6060
- setTheme(isDark() ? 'light' : 'dark');
6098
+ const next = isDark() ? 'light' : 'dark';
6099
+ if (getSettings().themeToggleSystem === true) {
6100
+ void applySystem(next).then((result) => {
6101
+ if (result?.ok === true) {
6102
+ // Host switched the OS theme; let DSH follow the system so both
6103
+ // palettes stay in sync.
6104
+ setTheme('system');
6105
+ } else {
6106
+ setTheme(next);
6107
+ notify(t('theme.osFailed'));
6108
+ }
6109
+ }).catch(() => {
6110
+ setTheme(next);
6111
+ notify(t('theme.osFailed'));
6112
+ });
6113
+ } else {
6114
+ setTheme(next);
6115
+ }
6061
6116
  refresh();
6062
6117
  });
6063
6118
  refresh();
@@ -6114,6 +6169,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
6114
6169
  setTheme: (id) => {
6115
6170
  try { if (typeof theme.setTheme === 'function') theme.setTheme(id); } catch { /* ignore */ }
6116
6171
  },
6172
+ notify: toastMessage,
6173
+ applySystem: (id) => {
6174
+ const scheme = id === 'dark' ? 'dark' : 'light';
6175
+ return fetch('/dsh-powerup/api/system-theme', {
6176
+ method: 'POST',
6177
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
6178
+ body: JSON.stringify({ scheme }),
6179
+ }).then((response) => response.json().catch(() => ({ ok: false })))
6180
+ .then((data) => ({ ok: data?.ok === true, supported: data?.supported === true }));
6181
+ },
6117
6182
  });
6118
6183
  scope.effect(() => {
6119
6184
  core.start();
@@ -11059,8 +11124,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11059
11124
  // ------------------------------------------------------------------
11060
11125
  /**
11061
11126
  * 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.
11127
+ * and the "how to use" tutorial. Description and tutorial are the only
11128
+ * two sections: fold-away sub-options (the "More" settings) are never
11129
+ * duplicated here — they live under the card's More button instead.
11064
11130
  */
11065
11131
  function FeatureDetailModal({ card, t, onClose }) {
11066
11132
  const [closing, setClosing] = useState(false);
@@ -11119,7 +11185,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11119
11185
  h('p', { className: 'dsh-powerup-detail-modal-desc' }, t(card.descKey)),
11120
11186
  )
11121
11187
  : null,
11122
- steps.length > 0
11188
+ (steps.length > 0 || card.modalExtra !== undefined && card.modalExtra !== null)
11123
11189
  ? h('section', { className: 'dsh-powerup-detail-section' },
11124
11190
  h('h3', { className: 'dsh-powerup-detail-section-title' }, t('page.sectionHow')),
11125
11191
  steps.length === 1
@@ -11130,9 +11196,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11130
11196
  h('span', null, step),
11131
11197
  )),
11132
11198
  ),
11199
+ card.modalExtra ?? null,
11133
11200
  )
11134
11201
  : null,
11135
- card.detail ?? null,
11136
11202
  ),
11137
11203
  ),
11138
11204
  ));
@@ -11188,11 +11254,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11188
11254
  /**
11189
11255
  * One uniform feature card: icon + title + a one-line brief with a
11190
11256
  * 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 }
11257
+ * and a right-aligned fold/unfold button on the card-foot row for
11258
+ * sub-options (the "More" settings; these never enter the detail modal).
11259
+ * opts: { descKey, howKey, howParts, detail, modalExtra }
11193
11260
  */
11194
11261
  const featureCard = (key, iconComp, titleKey, briefKey, opts = {}) => {
11195
- const { howKey, howParts, detail, descKey, detailAsDetails } = opts;
11262
+ const { howKey, howParts, detail, descKey, modalExtra } = opts;
11196
11263
  const hasSub = detail !== undefined && detail !== null;
11197
11264
  const expanded = expandedCards.has(key);
11198
11265
  const toggleExpanded = () => {
@@ -11202,7 +11269,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11202
11269
  setExpandedCards(next);
11203
11270
  };
11204
11271
  const hasDetail = descKey !== undefined || howKey !== undefined || Array.isArray(howParts);
11205
- const openDetail = () => setDetailCard({ key, iconComp, titleKey, descKey, howKey, howParts, detail });
11272
+ const openDetail = () => setDetailCard({ key, iconComp, titleKey, descKey, howKey, howParts, modalExtra });
11206
11273
  return h('section', {
11207
11274
  key,
11208
11275
  className: 'dsh-powerup-card' + (settings[key] === false ? ' is-off' : ''),
@@ -11224,7 +11291,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11224
11291
  ),
11225
11292
  ),
11226
11293
  ),
11227
- hasSub && !detailAsDetails
11294
+ hasSub
11228
11295
  ? h('div', { className: 'dsh-powerup-card-foot' },
11229
11296
  h('button', {
11230
11297
  type: 'button',
@@ -11236,7 +11303,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11236
11303
  h('span', null, t(expanded ? 'page.collapse' : 'page.more'))),
11237
11304
  )
11238
11305
  : null,
11239
- hasSub && !detailAsDetails && expanded
11306
+ hasSub && expanded
11240
11307
  ? h('div', { className: 'dsh-powerup-card-body' }, detail)
11241
11308
  : null,
11242
11309
  );
@@ -11330,18 +11397,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11330
11397
  featureCard('contextMenu', PowerUpLineIcon, 'page.featureTitle', 'page.featureBrief', {
11331
11398
  descKey: 'page.featureDesc',
11332
11399
  howParts: [t('page.featureHow1'), t('page.featureHow2'), t('page.featureHow3')],
11333
- detail: actionsDetail,
11334
- detailAsDetails: true,
11400
+ modalExtra: actionsDetail,
11335
11401
  }),
11336
11402
  featureCard('themeToggle', QuickIcon, 'page.themeTitle', 'page.themeBrief', {
11337
11403
  descKey: 'page.themeDesc',
11338
11404
  howKey: 'page.themeHow',
11405
+ detail: settingRow('themeToggleSystem', settings.themeToggleSystem === true,
11406
+ t('page.themeSystemLabel'), t('page.themeSystemHint')),
11339
11407
  }),
11340
11408
  featureCard('launcher', LauncherIcon, 'page.launcherTitle', 'page.launcherBrief', {
11341
11409
  descKey: 'page.launcherDesc',
11342
- detail: h('div', { className: 'dsh-powerup-card-detail' },
11343
- settingRow('launcher', settings.launcher !== false, t('page.launcherToggle'), t('page.launcherToggleHint')),
11344
- ),
11345
11410
  }),
11346
11411
  featureCard('sessionSwitch', QuickIcon, 'page.sessionSwitchTitle', 'page.sessionSwitchBrief', { howKey: 'page.sessionSwitchHow', descKey: 'page.sessionSwitchDesc' }),
11347
11412
  featureCard('locateSession', LocateIcon, 'page.locateTitle', 'page.locateBrief', { howKey: 'page.locateHow', descKey: 'page.locateDesc' }),
package/index.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * for the current session's composer
27
27
  * GET /dsh-powerup/api/quick-replies → reads the current session's options
28
28
  * POST /dsh-powerup/api/quick-replies → clears them after a user message
29
+ * POST /dsh-powerup/api/system-theme → flips the Windows OS light/dark mode
29
30
  *
30
31
  * The Client half drives other plugins' installation through the built-in
31
32
  * `pluginManager` Remote. Only the process restart, the self-update handoff,
@@ -38,6 +39,7 @@
38
39
  */
39
40
 
40
41
  import { randomUUID } from 'node:crypto';
42
+ import { execFile } from 'node:child_process';
41
43
  import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
42
44
  import { dirname, join, resolve as resolvePath, sep } from 'node:path';
43
45
  import { homedir } from 'node:os';
@@ -59,10 +61,28 @@ import {
59
61
  createQuickRepliesStore,
60
62
  createQuickRepliesTool,
61
63
  } from './lib/quick-replies.js';
64
+ import { describeSystemTheme, setSystemTheme } from './lib/system-theme.js';
62
65
 
63
66
  /** Prefix owned by this plugin. */
64
67
  const ROUTE = '/dsh-powerup/api';
65
68
 
69
+ /** Run a host command with a bounded timeout, capturing its output. */
70
+ function runCommand(command, args) {
71
+ return new Promise((resolve) => {
72
+ try {
73
+ execFile(command, args, { windowsHide: true, timeout: 8000 }, (error, stdout, stderr) => {
74
+ resolve({
75
+ code: typeof error?.code === 'number' ? error.code : (error ? 1 : 0),
76
+ stdout: String(stdout ?? ''),
77
+ stderr: String(stderr ?? ''),
78
+ });
79
+ });
80
+ } catch (error) {
81
+ resolve({ code: 1, stderr: String(error?.message ?? error) });
82
+ }
83
+ });
84
+ }
85
+
66
86
  /** The bundle this pair of routes may replace while its own UI unloads. */
67
87
  const MODULE_ID = '@restregular/dsh-powerup';
68
88
 
@@ -555,11 +575,31 @@ async function handle(req, res, ctx) {
555
575
 
556
576
  const url = new URL(req.url ?? ROUTE, 'http://localhost');
557
577
  const op = url.pathname.slice(ROUTE.length).replace(/^\/+/u, '') || url.searchParams.get('op') || '';
558
- if (op !== '' && op !== 'restart' && op !== 'close' && op !== 'self-update' && op !== 'audit' && op !== 'job-kill' && op !== 'prompts' && op !== 'mask-rules' && op !== 'progress' && op !== 'progress-requirements' && op !== 'progress-history' && op !== 'direct-ask' && op !== 'ask-title' && op !== 'quick-replies') {
578
+ if (op !== '' && op !== 'restart' && op !== 'close' && op !== 'self-update' && op !== 'audit' && op !== 'job-kill' && op !== 'prompts' && op !== 'mask-rules' && op !== 'progress' && op !== 'progress-requirements' && op !== 'progress-history' && op !== 'direct-ask' && op !== 'ask-title' && op !== 'quick-replies' && op !== 'system-theme') {
559
579
  sendJson(res, { ok: false, error: 'not-found' }, 404);
560
580
  return;
561
581
  }
562
582
 
583
+ if (op === 'system-theme') {
584
+ const capability = describeSystemTheme();
585
+ if (req.method === 'GET') {
586
+ sendJson(res, { ok: true, ...capability });
587
+ return;
588
+ }
589
+ if (req.method !== 'POST') {
590
+ sendJson(res, { ok: false, error: 'method-not-allowed' }, 405);
591
+ return;
592
+ }
593
+ try {
594
+ const body = await readJsonBody(req);
595
+ const result = await setSystemTheme(body, { run: runCommand });
596
+ sendJson(res, result, result.ok ? 200 : 409);
597
+ } catch (error) {
598
+ sendJson(res, { ok: false, error: String(error?.message ?? error) }, 500);
599
+ }
600
+ return;
601
+ }
602
+
563
603
  if (op === 'quick-replies') {
564
604
  const store = createQuickRepliesStore({
565
605
  file: storePath(QUICK_REPLIES_FILE),
@@ -0,0 +1,72 @@
1
+ /**
2
+ * dsh-powerup — flip the Windows OS light/dark mode.
3
+ *
4
+ * The browser cannot change the operating system palette; only the Host half
5
+ * can. On Windows the per-user preference lives under
6
+ * `HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize` with two
7
+ * DWORD values: `AppsUseLightTheme` (app palette) and `SystemUsesLightTheme`
8
+ * (taskbar/Start palette). After writing them, an `ImmersiveColorSet`
9
+ * `WM_SETTINGCHANGE` broadcast tells running apps to re-read the preference.
10
+ *
11
+ * Both writes go through `reg.exe` / PowerShell `Add-Type`, launched via the
12
+ * injected `run` callback so this module stays pure and testable. The caller
13
+ * must guarantee the request came from the loopback Host origin.
14
+ *
15
+ * @module dsh-powerup/system-theme
16
+ */
17
+
18
+ /** Registry key holding the per-user light/dark preference. */
19
+ export const PERSONALIZE_KEY = 'Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize';
20
+
21
+ /**
22
+ * Describe whether this Host can switch the OS theme.
23
+ * @param {{ platform?: string, execPath?: string }} env runtime environment
24
+ * @returns {{ supported: boolean, reason?: string }}
25
+ */
26
+ export function describeSystemTheme(env = {}) {
27
+ const platform = typeof env.platform === 'string' ? env.platform : process.platform;
28
+ if (platform !== 'win32') {
29
+ return { supported: false, reason: 'OS theme switching is only available on Windows.' };
30
+ }
31
+ return { supported: true };
32
+ }
33
+
34
+ /**
35
+ * Apply the requested OS color scheme.
36
+ * @param {{ scheme: 'light' | 'dark' }} request
37
+ * @param {{ platform?: string, run: (command: string, args: string[]) => Promise<{ code: number, stdout?: string, stderr?: string }> }} deps
38
+ * @returns {Promise<{ ok: boolean, supported: boolean, scheme?: string, reason?: string }>}
39
+ */
40
+ export async function setSystemTheme(request, deps) {
41
+ const capability = describeSystemTheme(deps ?? {});
42
+ if (!capability.supported) return { ok: false, supported: false, reason: capability.reason };
43
+ const scheme = request?.scheme === 'light' ? 'light' : request?.scheme === 'dark' ? 'dark' : null;
44
+ if (scheme === null) return { ok: false, supported: true, reason: 'scheme must be light or dark' };
45
+ const run = typeof deps?.run === 'function' ? deps.run : null;
46
+ if (run === null) return { ok: false, supported: true, reason: 'no command runner available' };
47
+
48
+ const value = scheme === 'light' ? '1' : '0';
49
+ const key = `HKCU\\${PERSONALIZE_KEY}`;
50
+ try {
51
+ for (const name of ['AppsUseLightTheme', 'SystemUsesLightTheme']) {
52
+ const result = await run('reg.exe', ['add', key, '/v', name, '/t', 'REG_DWORD', '/d', value, '/f']);
53
+ if (result?.code !== 0) {
54
+ return { ok: false, supported: true, reason: `failed to write ${name}: ${String(result?.stderr ?? '').trim()}` };
55
+ }
56
+ }
57
+ // Broadcast the settings change so running apps pick up the new palette.
58
+ // PowerShell is available on every supported Windows desktop; Add-Type is
59
+ // scoped to this process so no file is written.
60
+ const ps = [
61
+ '-NoProfile', '-NonInteractive', '-Command',
62
+ "Add-Type -TypeDefinition 'using System;using System.Runtime.InteropServices;public class PowerupTheme{[DllImport(\"user32.dll\",SetLastError=true,CharSet=CharSet.Auto)]public static extern IntPtr SendMessageTimeout(IntPtr hWnd,uint Msg,UIntPtr wParam,string lParam,uint fuFlags,uint uTimeout,out UIntPtr lpdwResult);};';" +
63
+ '$r=[UIntPtr]::Zero;[void][PowerupTheme]::SendMessageTimeout([IntPtr]0xffff,0x001A,[UIntPtr]::Zero,"ImmersiveColorSet",2,1000,[ref]$r)',
64
+ ];
65
+ const broadcast = await run('powershell.exe', ps);
66
+ // The broadcast is best-effort: even if it fails the registry values are
67
+ // written and will apply to apps that start afterwards.
68
+ return { ok: true, supported: true, scheme, broadcast: broadcast?.code === 0 };
69
+ } catch (error) {
70
+ return { ok: false, supported: true, reason: String(error?.message ?? error) };
71
+ }
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.14",
3
+ "version": "0.19.16",
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",
@@ -26,6 +26,7 @@
26
26
  "lib/task-resume.js",
27
27
  "lib/direct-ask.js",
28
28
  "lib/quick-replies.js",
29
+ "lib/system-theme.js",
29
30
  "locale/*.json",
30
31
  "icon.svg",
31
32
  "README.md",
@@ -99,7 +100,7 @@
99
100
  "node": ">=22.13.0"
100
101
  },
101
102
  "scripts": {
102
- "test": "node test/smoke.mjs && node test/host.mjs && node test/progress.mjs && node test/task-resume.mjs && node test/direct-ask.mjs && node test/quick-replies.mjs"
103
+ "test": "node test/smoke.mjs && node test/host.mjs && node test/progress.mjs && node test/task-resume.mjs && node test/direct-ask.mjs && node test/quick-replies.mjs && node test/system-theme.mjs"
103
104
  },
104
105
  "license": "MIT",
105
106
  "author": "RestRegular"