@laraveladmin/dsh-stay-awake 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # 变更记录 · Changelog
2
2
 
3
+ ## 0.2.5 — 2026-12-03
4
+
5
+ ### 优化
6
+
7
+ - 弹层「后端」一行改为本地化名称:macOS「macOS 系统唤醒(caffeinate)」、Windows「Windows 执行状态锁」、
8
+ Linux「systemd 抑制锁」;原始标识符保留在悬停提示里,便于排障。
9
+ - 未知错误码不再把英文原文直接显示给用户:改为本地化的通用说明,原始错误文本放入悬停提示。
10
+
3
11
  ## 0.2.4 — 2026-12-03
4
12
 
5
13
  ### 修复
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.5-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.5`](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.5-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.5`](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(
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.5",
4
4
  "description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs.",
5
5
  "keywords": [
6
6
  "dsh-plugin",