@laraveladmin/dsh-stay-awake 0.2.3 → 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,20 @@
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
+
11
+ ## 0.2.4 — 2026-12-03
12
+
13
+ ### 修复
14
+
15
+ - 弹层展开后异常变高:绝对定位同时设置 `top`/`bottom` 且高度为 auto 时元素会被拉伸去填满,
16
+ 漏了宿主样式里的 `height:fit-content; min-height:0`。补上后弹层按内容高度显示。
17
+
3
18
  ## 0.2.3 — 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.3-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.3`](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.3-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.3`](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',
@@ -119,10 +127,12 @@ window.__ModuleLoader__.load({
119
127
  .dsa-pill svg{flex:none;width:14px;height:14px}
120
128
  .dsa-label{text-overflow:ellipsis;min-width:0;overflow:hidden}
121
129
  .dsa-dot{width:5px;height:5px;border-radius:50%;flex:none}
122
- .dsa-panel{position:fixed;left:50%;bottom:150px;transform:translateX(-50%);z-index:1100;box-sizing:border-box;border:0;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);width:max-content;min-width:min(300px,100vw - 24px);max-width:min(440px,100vw - 24px);max-height:calc(100dvh - 24px);overflow:hidden auto;margin:0;padding:16px;font-size:12px;line-height:18px;cursor:default;pointer-events:auto;text-align:left}
130
+ .dsa-panel{position:fixed;left:50%;bottom:150px;transform:translateX(-50%);z-index:1100;box-sizing:border-box;height:fit-content;min-height:0;border:0;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);width:max-content;min-width:min(300px,100vw - 24px);max-width:min(440px,100vw - 24px);max-height:calc(100dvh - 24px);overflow:hidden auto;margin:0;padding:16px;font-size:12px;line-height:18px;cursor:default;pointer-events:auto;text-align:left}
123
131
  @supports (position-anchor: --dsh-stay-awake-panel){
124
- .dsa-panel{position-anchor:--dsh-stay-awake-panel;top:max(12px, var(--dsh-frame-overlay-top,12px));bottom:max(12px, calc(anchor(top) + 8px));left:max(12px, anchor(left));right:12px;transform:none;position-try-fallbacks:flip-block, flip-inline;max-height:calc(100dvh - 12px - max(12px, var(--dsh-frame-overlay-top,12px)))}
132
+ .dsa-panel{position-anchor:--dsh-stay-awake-panel;top:auto;bottom:max(12px, calc(anchor(top) + 8px));left:max(12px, anchor(left));right:auto;transform:none;height:fit-content;max-height:calc(100dvh - 24px);position-try-fallbacks:--dsa-below, --dsa-wide}
125
133
  }
134
+ @position-try --dsa-below{top:max(12px, calc(anchor(bottom) + 8px));bottom:auto}
135
+ @position-try --dsa-wide{left:12px;right:12px;justify-self:stretch}
126
136
  .dsa-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px;color:var(--dsw-alias-label-primary);font-weight:500}
127
137
  .dsa-head-label{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
128
138
  .dsa-head-label svg{flex:none;width:14px;height:14px}
@@ -226,11 +236,25 @@ window.__ModuleLoader__.load({
226
236
  return 'var(--dsw-alias-state-idle-primary)'
227
237
  }
228
238
 
229
- function errorText(t, status) {
230
- if (status.lastErrorCode === 'exited') return t('error.exited')
231
- if (status.lastErrorCode === 'backend-failed') return t('error.backend')
232
- if (status.lastErrorCode === 'unsupported') return t('error.unsupported')
233
- 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
234
258
  }
235
259
 
236
260
  function Moon({ color }) {
@@ -366,17 +390,18 @@ window.__ModuleLoader__.load({
366
390
 
367
391
  if (!open) return null
368
392
 
393
+ const backend = backendInfo(t, status)
369
394
  const rows = [
370
395
  [t('detail.sources'), `${t('sources.agents')} ${counts.agents ?? 0} · ${t('sources.maintenance')} ${counts.maintenance ?? 0} · ${t('sources.jobs')} ${counts.jobs ?? 0}`],
371
396
  [t('detail.scope'), allowDisplaySleep ? t('scope.system') : t('scope.display')],
372
- [t('detail.backend'), status && status.backend ? status.backend : t('unit.none')],
397
+ [t('detail.backend'), backend.text, backend.raw],
373
398
  ]
374
399
  if (status && typeof status.since === 'number' && status.since > 0) {
375
400
  rows.push([t('detail.since'), formatDuration(Date.now() - status.since)])
376
401
  }
377
402
  if (holdLeft !== null) rows.push([t('panel.hold'), `${t('panel.holdLeft')} ${formatDuration(holdLeft)}`])
378
- const reason = status !== null && !unreachable ? errorText(t, status) : null
379
- 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])
380
405
 
381
406
  const switchOf = (checked, onClick, label, extraDisabled = false) => h('button', {
382
407
  type: 'button',
@@ -412,9 +437,9 @@ window.__ModuleLoader__.load({
412
437
  : h(
413
438
  'dl',
414
439
  { className: 'dsa-grid', key: 'grid' },
415
- rows.flatMap(([key, value], index) => [
440
+ rows.flatMap(([key, value, tip], index) => [
416
441
  h('dt', { key: `k${index}`, className: 'dsa-key' }, key),
417
- h('dd', { key: `v${index}`, className: 'dsa-val', title: value }, value),
442
+ h('dd', { key: `v${index}`, className: 'dsa-val', title: tip ?? value }, value),
418
443
  ]),
419
444
  ),
420
445
  h(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laraveladmin/dsh-stay-awake",
3
- "version": "0.2.3",
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",