@laraveladmin/dsh-stay-awake 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # 变更记录 · Changelog
2
2
 
3
+ ## 0.2.6 — 2026-12-03
4
+
5
+ ### 文档
6
+
7
+ - README 界面示意图按当前实际界面更新:状态栏触发 pill 带状态圆点、弹层为内容自适应高度的宿主同款浮层,
8
+ 「后端」行展示本地化名称(悬停提示保留 `caffeinate` 原始标识),底部版本号同步为 v0.2.6。
9
+
10
+ ## 0.2.5 — 2026-12-03
11
+
12
+ ### 优化
13
+
14
+ - 弹层「后端」一行改为本地化名称:macOS「macOS 系统唤醒(caffeinate)」、Windows「Windows 执行状态锁」、
15
+ Linux「systemd 抑制锁」;原始标识符保留在悬停提示里,便于排障。
16
+ - 未知错误码不再把英文原文直接显示给用户:改为本地化的通用说明,原始错误文本放入悬停提示。
17
+
3
18
  ## 0.2.4 — 2026-12-03
4
19
 
5
20
  ### 修复
package/README.en.md CHANGED
@@ -7,7 +7,7 @@
7
7
  `@laraveladmin/dsh-stay-awake` · macOS / Windows / Linux
8
8
 
9
9
  <p>
10
- <img alt="version" src="https://img.shields.io/badge/version-0.2.4-blue">
10
+ <img alt="version" src="https://img.shields.io/badge/version-0.2.6-blue">
11
11
  <img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-4c6ef5">
12
12
  <img alt="license" src="https://img.shields.io/badge/license-MIT-green">
13
13
  </p>
@@ -63,7 +63,7 @@ A short alert when a task finishes, played on the machine that runs the DSH host
63
63
 
64
64
  **Requirements**: DSH 0.2.x (Desktop or `dsh web`). The plugin has no third-party runtime dependencies and needs no Node toolchain.
65
65
 
66
- Published on npm: [`@laraveladmin/dsh-stay-awake@0.2.4`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
66
+ Published on npm: [`@laraveladmin/dsh-stay-awake@0.2.6`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
67
67
 
68
68
  ### Option 1 — install from npm (recommended)
69
69
 
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  `@laraveladmin/dsh-stay-awake` · macOS / Windows / Linux
8
8
 
9
9
  <p>
10
- <img alt="version" src="https://img.shields.io/badge/version-0.2.4-blue">
10
+ <img alt="version" src="https://img.shields.io/badge/version-0.2.6-blue">
11
11
  <img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-4c6ef5">
12
12
  <img alt="license" src="https://img.shields.io/badge/license-MIT-green">
13
13
  </p>
@@ -64,7 +64,7 @@ DSH 跑长任务时你离开电脑,系统按空闲策略休眠:进程被挂
64
64
 
65
65
  **前置条件**:DSH 0.2.x(Desktop 或 `dsh web`)。插件零第三方运行时依赖,不需要 Node 工具链。
66
66
 
67
- 已发布到 npm:[`@laraveladmin/dsh-stay-awake@0.2.4`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
67
+ 已发布到 npm:[`@laraveladmin/dsh-stay-awake@0.2.6`](https://www.npmjs.com/package/@laraveladmin/dsh-stay-awake)
68
68
 
69
69
  ### 方式一:从 npm 安装(推荐)
70
70
 
package/client.js CHANGED
@@ -49,6 +49,10 @@ window.__ModuleLoader__.load({
49
49
  'error.exited': '电源断言被意外终止,正在重试',
50
50
  'error.backend': '无法启动电源断言后端',
51
51
  'error.unsupported': '当前平台没有可用的电源后端',
52
+ 'error.unknown': '电源断言出现未知错误',
53
+ 'backend.caffeinate': 'macOS 系统唤醒(caffeinate)',
54
+ 'backend.setthreadexecutionstate': 'Windows 执行状态锁',
55
+ 'backend.systemd-inhibit': 'systemd 抑制锁',
52
56
  'panel.enabled': '总开关',
53
57
  'panel.allowDisplaySleep': '允许屏幕休眠',
54
58
  'panel.allowDisplaySleepHint': '开启后只防系统休眠,屏幕按系统设置熄灭',
@@ -92,6 +96,10 @@ window.__ModuleLoader__.load({
92
96
  'error.exited': 'The power assertion exited unexpectedly; retrying',
93
97
  'error.backend': 'Could not start the power assertion backend',
94
98
  'error.unsupported': 'No power backend is available on this platform',
99
+ 'error.unknown': 'The power assertion reported an unknown error',
100
+ 'backend.caffeinate': 'macOS wake lock (caffeinate)',
101
+ 'backend.setthreadexecutionstate': 'Windows execution state lock',
102
+ 'backend.systemd-inhibit': 'systemd inhibitor',
95
103
  'panel.enabled': 'Enabled',
96
104
  'panel.allowDisplaySleep': 'Allow display sleep',
97
105
  'panel.allowDisplaySleepHint': 'Only system sleep is blocked; the screen follows the OS setting',
@@ -228,11 +236,25 @@ window.__ModuleLoader__.load({
228
236
  return 'var(--dsw-alias-state-idle-primary)'
229
237
  }
230
238
 
231
- function errorText(t, status) {
232
- if (status.lastErrorCode === 'exited') return t('error.exited')
233
- if (status.lastErrorCode === 'backend-failed') return t('error.backend')
234
- if (status.lastErrorCode === 'unsupported') return t('error.unsupported')
235
- return typeof status.lastError === 'string' && status.lastError !== '' ? status.lastError : null
239
+ const KNOWN_BACKENDS = new Set(['caffeinate', 'setthreadexecutionstate', 'systemd-inhibit'])
240
+
241
+ /** Localized backend name; the raw identifier stays available as a tooltip. */
242
+ function backendInfo(t, status) {
243
+ const id = status && status.backend
244
+ if (typeof id !== 'string' || id === '') return { text: t('unit.none') }
245
+ if (KNOWN_BACKENDS.has(id)) return { text: t(`backend.${id}`), raw: id }
246
+ return { text: id }
247
+ }
248
+
249
+ /** Known error codes are localized; an unknown one gets a generic message plus the raw text. */
250
+ function errorInfo(t, status) {
251
+ if (status.lastErrorCode === 'exited') return { text: t('error.exited') }
252
+ if (status.lastErrorCode === 'backend-failed') return { text: t('error.backend') }
253
+ if (status.lastErrorCode === 'unsupported') return { text: t('error.unsupported') }
254
+ if (typeof status.lastError === 'string' && status.lastError !== '') {
255
+ return { text: t('error.unknown'), raw: status.lastError }
256
+ }
257
+ return null
236
258
  }
237
259
 
238
260
  function Moon({ color }) {
@@ -368,17 +390,18 @@ window.__ModuleLoader__.load({
368
390
 
369
391
  if (!open) return null
370
392
 
393
+ const backend = backendInfo(t, status)
371
394
  const rows = [
372
395
  [t('detail.sources'), `${t('sources.agents')} ${counts.agents ?? 0} · ${t('sources.maintenance')} ${counts.maintenance ?? 0} · ${t('sources.jobs')} ${counts.jobs ?? 0}`],
373
396
  [t('detail.scope'), allowDisplaySleep ? t('scope.system') : t('scope.display')],
374
- [t('detail.backend'), status && status.backend ? status.backend : t('unit.none')],
397
+ [t('detail.backend'), backend.text, backend.raw],
375
398
  ]
376
399
  if (status && typeof status.since === 'number' && status.since > 0) {
377
400
  rows.push([t('detail.since'), formatDuration(Date.now() - status.since)])
378
401
  }
379
402
  if (holdLeft !== null) rows.push([t('panel.hold'), `${t('panel.holdLeft')} ${formatDuration(holdLeft)}`])
380
- const reason = status !== null && !unreachable ? errorText(t, status) : null
381
- if (reason !== null) rows.push([t('detail.error'), reason])
403
+ const reason = status !== null && !unreachable ? errorInfo(t, status) : null
404
+ if (reason !== null) rows.push([t('detail.error'), reason.text, reason.raw])
382
405
 
383
406
  const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
384
407
  type: 'button',
@@ -414,9 +437,9 @@ window.__ModuleLoader__.load({
414
437
  : h(
415
438
  'dl',
416
439
  { className: 'dsa-grid', key: 'grid' },
417
- rows.flatMap(([key, value], index) => [
440
+ rows.flatMap(([key, value, tip], index) => [
418
441
  h('dt', { key: `k${index}`, className: 'dsa-key' }, key),
419
- h('dd', { key: `v${index}`, className: 'dsa-val', title: value }, value),
442
+ h('dd', { key: `v${index}`, className: 'dsa-val', title: tip ?? value }, value),
420
443
  ]),
421
444
  ),
422
445
  h(
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 420 424" width="420" height="424" role="img" aria-label="设置弹层示意">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 460 470" width="460" height="470" role="img" aria-label="设置弹层示意">
2
2
  <defs>
3
3
  <filter id="sh" x="-20%" y="-20%" width="140%" height="140%">
4
4
  <feDropShadow dx="0" dy="8" stdDeviation="14" flood-color="#0b1220" flood-opacity="0.16"/>
@@ -14,49 +14,49 @@
14
14
  .rule{stroke:#e5e7eb;stroke-width:1}
15
15
  </style>
16
16
 
17
- <rect width="420" height="424" fill="#eef0f3"/>
17
+ <rect width="460" height="470" fill="#eef0f3"/>
18
18
 
19
19
  <!-- composer dock with the trigger pill, to show the anchor relationship -->
20
- <rect x="30" y="30" width="360" height="30" rx="8" fill="#ffffff" stroke="#e4e6eb"/>
21
- <g transform="translate(196,36)">
20
+ <rect x="30" y="30" width="400" height="30" rx="8" fill="#ffffff" stroke="#e4e6eb"/>
21
+ <g transform="translate(214,36)">
22
22
  <path d="M9 1.5a6 6 0 1 0 3.7 9A4.9 4.9 0 0 1 9 1.5z" fill="#22c55e" transform="scale(1.1)"/>
23
23
  <text class="t" x="16" y="15" font-size="12" fill="#9aa0a8">守夜 · 保持中</text>
24
+ <circle cx="103" cy="10" r="2.5" fill="#22c55e"/>
24
25
  </g>
25
26
 
26
27
  <!-- popover panel: anchored above the pill, host dialog styling -->
27
28
  <g filter="url(#sh)">
28
- <rect x="30" y="76" width="360" height="318" rx="12" fill="#ffffff"/>
29
+ <rect x="30" y="76" width="400" height="376" rx="12" fill="#ffffff"/>
29
30
  </g>
30
31
  <g class="t">
31
32
  <!-- title row -->
32
33
  <path d="M46 90a7 7 0 1 0 4.4 10.5A5.8 5.8 0 0 1 46 90z" fill="#22c55e"/>
33
34
  <text class="t title" x="62" y="101">守夜</text>
34
- <text class="t" x="300" y="101" text-anchor="end" font-size="13" fill="#111827">保持中</text>
35
- <text class="t" x="352" y="102" text-anchor="middle" font-size="15" fill="#9aa0a8">×</text>
35
+ <text class="t" x="414" y="101" text-anchor="end" font-size="13" fill="#111827">保持中</text>
36
36
 
37
- <line class="rule" x1="46" y1="114" x2="374" y2="114"/>
37
+ <line class="rule" x1="46" y1="114" x2="414" y2="114"/>
38
38
 
39
- <!-- details grid -->
40
- <text class="key" x="46" y="138">活跃源</text><text class="val" x="374" y="138" text-anchor="end">会话 1 · 维护 0 · 后台任务 0</text>
41
- <text class="key" x="46" y="162">范围</text><text class="val" x="374" y="162" text-anchor="end">仅系统</text>
42
- <text class="key" x="46" y="186">后端</text><text class="val" x="374" y="186" text-anchor="end">caffeinate</text>
43
- <text class="key" x="46" y="210">已持续</text><text class="val" x="374" y="210" text-anchor="end">00:12:31</text>
39
+ <!-- details grid: localized backend name is shown, raw id lives in the tooltip -->
40
+ <text class="key" x="46" y="138">活跃源</text><text class="val" x="414" y="138" text-anchor="end">会话 1 · 维护 0 · 后台任务 0</text>
41
+ <text class="key" x="46" y="162">范围</text><text class="val" x="414" y="162" text-anchor="end">仅系统</text>
42
+ <text class="key" x="46" y="186">后端</text><text class="val" x="414" y="186" text-anchor="end">macOS 系统唤醒(caffeinate)</text>
43
+ <text class="key" x="46" y="210">已持续</text><text class="val" x="414" y="210" text-anchor="end">00:12:31</text>
44
44
 
45
45
  <!-- switches -->
46
46
  <text class="label" x="46" y="258">总开关</text>
47
- <rect x="340" y="247" width="34" height="18" rx="9" fill="#22c55e"/>
48
- <circle cx="365" cy="256" r="6" fill="#ffffff"/>
47
+ <rect x="380" y="247" width="34" height="18" rx="9" fill="#22c55e"/>
48
+ <circle cx="405" cy="256" r="6" fill="#ffffff"/>
49
49
 
50
50
  <text class="label" x="46" y="286">允许屏幕休眠</text>
51
51
  <text class="sub" x="46" y="301">只防系统休眠,屏幕按系统设置熄灭</text>
52
- <rect x="340" y="275" width="34" height="18" rx="9" fill="#22c55e"/>
53
- <circle cx="365" cy="284" r="6" fill="#ffffff"/>
52
+ <rect x="380" y="275" width="34" height="18" rx="9" fill="#22c55e"/>
53
+ <circle cx="405" cy="284" r="6" fill="#ffffff"/>
54
54
 
55
55
  <text class="label" x="46" y="330">完成提示音</text>
56
- <rect x="266" y="317" width="56" height="22" rx="6" fill="#f3f4f6"/>
57
- <text class="t" x="294" y="332" text-anchor="middle" font-size="12" fill="#374151">试听</text>
58
- <rect x="340" y="319" width="34" height="18" rx="9" fill="#22c55e"/>
59
- <circle cx="365" cy="328" r="6" fill="#ffffff"/>
56
+ <rect x="306" y="317" width="56" height="22" rx="6" fill="#f3f4f6"/>
57
+ <text class="t" x="334" y="332" text-anchor="middle" font-size="12" fill="#374151">试听</text>
58
+ <rect x="380" y="319" width="34" height="18" rx="9" fill="#22c55e"/>
59
+ <circle cx="405" cy="328" r="6" fill="#ffffff"/>
60
60
 
61
61
  <!-- hold -->
62
62
  <text class="sub" x="46" y="368">临时保持</text>
@@ -65,9 +65,9 @@
65
65
  <rect x="116" y="376" width="58" height="22" rx="6" fill="#f3f4f6"/>
66
66
  <text class="t" x="145" y="391" text-anchor="middle" font-size="12" fill="#374151">2 小时</text>
67
67
 
68
- <line class="rule" x1="46" y1="410" x2="374" y2="410"/>
69
- <text class="sub" x="46" y="428">防抖、音效等高级参数在 cordis.patch.yml 中配置</text>
70
- <path d="M332 419 l-3 3.2 3 3.2 M338 419 l3 3.2 -3 3.2" fill="none" stroke="#9aa0a8" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
71
- <text class="sub" x="352" y="428">v0.2.2</text>
68
+ <line class="rule" x1="46" y1="410" x2="414" y2="410"/>
69
+ <text class="sub" x="46" y="430">防抖、音效等高级参数在 cordis.patch.yml 中配置</text>
70
+ <path d="M372 420 l-3 3.2 3 3.2 M378 420 l3 3.2 -3 3.2" fill="none" stroke="#9aa0a8" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
71
+ <text class="sub" x="392" y="430">v0.2.6</text>
72
72
  </g>
73
73
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laraveladmin/dsh-stay-awake",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs.",
5
5
  "keywords": [
6
6
  "dsh-plugin",