@laraveladmin/dsh-stay-awake 0.2.14 → 0.3.0
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 +40 -0
- package/README.en.md +35 -11
- package/README.md +35 -11
- package/client.js +152 -12
- package/docs/REQUIREMENTS.md +35 -11
- package/docs/VERIFICATION.md +44 -0
- package/index.js +107 -1
- package/lib/auto-resume.js +95 -0
- package/lib/config.js +35 -0
- package/lib/probe.js +50 -0
- package/lib/resume.js +173 -0
- package/lib/server.js +22 -8
- package/lib/sound.js +19 -4
- package/lib/state.js +2 -1
- package/locale/en.json +1 -1
- package/locale/zh-Hant.json +6 -0
- package/locale/zh.json +1 -1
- package/market/index.json +2 -2
- package/package.json +2 -2
package/lib/sound.js
CHANGED
|
@@ -13,25 +13,38 @@ import { spawn as nodeSpawn } from 'node:child_process'
|
|
|
13
13
|
|
|
14
14
|
const MAC_SUCCESS = '/System/Library/Sounds/Glass.aiff'
|
|
15
15
|
const MAC_ERROR = '/System/Library/Sounds/Basso.aiff'
|
|
16
|
+
// A third voice for "the agent needs an answer": recognisably not "done" and
|
|
17
|
+
// not "failed", so a question never gets mistaken for the end of the work.
|
|
18
|
+
const MAC_QUESTION = '/System/Library/Sounds/Ping.aiff'
|
|
16
19
|
const LINUX_SUCCESS = '/usr/share/sounds/freedesktop/stereo/complete.oga'
|
|
17
20
|
const LINUX_ERROR = '/usr/share/sounds/freedesktop/stereo/dialog-error.oga'
|
|
21
|
+
const LINUX_QUESTION = '/usr/share/sounds/freedesktop/stereo/message.oga'
|
|
18
22
|
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @param {object} options
|
|
25
|
+
* @param {string} options.platform
|
|
26
|
+
* @param {'success'|'error'|'question'} [options.kind]
|
|
27
|
+
* @param {object} [options.config]
|
|
28
|
+
* @returns {{ command: string, args: string[] } | null}
|
|
29
|
+
*/
|
|
20
30
|
export function buildSoundCommand({ platform, kind = 'success', config = {} }) {
|
|
21
31
|
const isError = kind === 'error'
|
|
32
|
+
const isQuestion = kind === 'question'
|
|
22
33
|
const volume = Number(config.soundVolume)
|
|
23
34
|
|
|
24
35
|
if (platform === 'darwin') {
|
|
25
36
|
const file = isError
|
|
26
37
|
? config.errorSound || MAC_ERROR
|
|
27
|
-
:
|
|
38
|
+
: isQuestion
|
|
39
|
+
? config.questionSound || MAC_QUESTION
|
|
40
|
+
: config.successSound || MAC_SUCCESS
|
|
28
41
|
const args = [file]
|
|
29
42
|
if (Number.isFinite(volume) && volume > 0 && volume !== 1) args.push('-v', String(volume))
|
|
30
43
|
return { command: '/usr/bin/afplay', args }
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
if (platform === 'win32') {
|
|
34
|
-
const sound = isError ? 'Hand' : 'Asterisk'
|
|
47
|
+
const sound = isError ? 'Hand' : isQuestion ? 'Question' : 'Asterisk'
|
|
35
48
|
return {
|
|
36
49
|
command: 'powershell.exe',
|
|
37
50
|
args: ['-NoProfile', '-NonInteractive', '-Command', `[System.Media.SystemSounds]::${sound}.Play()`],
|
|
@@ -41,7 +54,9 @@ export function buildSoundCommand({ platform, kind = 'success', config = {} }) {
|
|
|
41
54
|
if (platform === 'linux') {
|
|
42
55
|
const file = isError
|
|
43
56
|
? config.errorSound || LINUX_ERROR
|
|
44
|
-
:
|
|
57
|
+
: isQuestion
|
|
58
|
+
? config.questionSound || LINUX_QUESTION
|
|
59
|
+
: config.successSound || LINUX_SUCCESS
|
|
45
60
|
const args = [file]
|
|
46
61
|
if (Number.isFinite(volume) && volume > 0) args.push('--volume', String(Math.round(volume * 65536)))
|
|
47
62
|
return { command: 'paplay', args }
|
package/lib/state.js
CHANGED
|
@@ -27,11 +27,12 @@ export function sanitizeState(raw) {
|
|
|
27
27
|
if (typeof raw.enabled === 'boolean') result.enabled = raw.enabled
|
|
28
28
|
if (SCOPES.has(raw.scope)) result.scope = raw.scope
|
|
29
29
|
if (typeof raw.sound === 'boolean') result.sound = raw.sound
|
|
30
|
+
if (typeof raw.autoResume === 'boolean') result.autoResume = raw.autoResume
|
|
30
31
|
return result
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
* @returns {{ state: { enabled?: boolean, scope?: 'system'|'display' }, warning: string | null }}
|
|
35
|
+
* @returns {{ state: { enabled?: boolean, scope?: 'system'|'display', sound?: boolean, autoResume?: boolean }, warning: string | null }}
|
|
35
36
|
*/
|
|
36
37
|
export function loadState(path) {
|
|
37
38
|
let text
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Stay awake",
|
|
4
|
-
"description": "Keeps this machine awake only while unattended work is still running — agent turns, background jobs and manual compaction — then releases automatically. The composer status bar shows whether it is holding
|
|
4
|
+
"description": "Keeps this machine awake only while unattended work is still running — agent turns, background jobs and manual compaction — then releases automatically, retries the turn that died while offline once the network is back, and rings a distinct cue when the agent needs your answer or an approval. The composer status bar shows whether it is holding."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "守夜",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "只在会话执行、后台任务或手动压缩等「无人值守仍在继续」的工作存在时保持系统不休眠,工作全部结束后自动释放;断网导致任务失败时,网络恢复后自动重试那一轮;需要你回答或审批时也会响一声提示音。输入框下方状态栏显示当前是否保持,悬停可看活跃源与已持续时长。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/market/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laraveladmin/dsh-stay-awake",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs.",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs, and retries the turn that died with the network once it is back.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|
|
7
7
|
"deepseek-harness",
|