@laraveladmin/dsh-stay-awake 0.3.2 → 0.3.4
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 +32 -0
- package/README.en.md +6 -1
- package/README.md +6 -1
- package/docs/VERIFICATION.md +31 -0
- package/index.js +140 -39
- package/lib/config.js +10 -0
- package/market/index.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# 变更记录 · Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4 — 2026-12-03
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- **提问/审批提醒音根本没响**:根因是 waterfall 监听顺序。Web 桥(`dsh-api-remotes`)在本插件之前注册,
|
|
8
|
+
而它的监听器回答了问题后**不会调用 `next()`**,所以注册在其后的监听器永远不执行。改用宿主
|
|
9
|
+
`sessionController.state().pendingInput`(含 `question` / `approval` / `other`)每 1.5 秒轮询一次——
|
|
10
|
+
本地读取、不联网、与监听顺序无关;状态清空后立即停止重复提醒。
|
|
11
|
+
- **手动停止不再响完成音**:`aborted`(用户按停止/父级取消)、`blocked`、`interrupted`、`max-tokens`、
|
|
12
|
+
`forked` 一律静音;只有 `completed` 响完成音、`error` 响失败音。你在键盘前按的停止不需要"过来看看"。
|
|
13
|
+
- **目标(goal)不再逐阶段响**:goal 处于 armed 状态时阶段完成静音;activation 解除后的整段结束才响一次
|
|
14
|
+
(响哪一声取决于最后那个回合是完成还是出错)。中途的提问/审批提醒不受影响。
|
|
15
|
+
- 新增配置 `questionPollMs`(默认 1500,最小 200)。
|
|
16
|
+
- 测试 115 → **120 全绿**(轮询检测 question/approval、子代理会话提问、重复与停止、手动停止静音、
|
|
17
|
+
goal 阶段静音与结束响一次、goal 中途提问照响)。
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 0.3.3 — 2026-12-03
|
|
21
|
+
|
|
22
|
+
### 改进
|
|
23
|
+
|
|
24
|
+
- 「需要你回答」的提醒音改为**重复提醒直到你回答**:默认每 20 秒响一次、最多 10 分钟,问题被回答后立刻停止
|
|
25
|
+
(监听 waterfall 的 `next()` 结算来取消)。单声 `Ping` 太短太轻,离开屏幕时很容易错过。
|
|
26
|
+
- 新增配置 `questionRepeatSeconds`(默认 20,0 = 只响一次)与 `questionRepeatMaxMinutes`(默认 10)。
|
|
27
|
+
- 新增 2 项测试:未回答时确实重复、回答后停止;配置默认值与钳制。单测 113 → 115。
|
|
28
|
+
|
|
29
|
+
### 说明
|
|
30
|
+
|
|
31
|
+
- 关于「重启后试听要点两次才出声」:宿主重启后的头几秒插件路由才注册完成,第一次点击可能落在宿主初始化窗口里;
|
|
32
|
+
插件本身每次点击都会带 `force` 绕过 1 秒节流,不存在需要点两次的逻辑。
|
|
33
|
+
|
|
34
|
+
|
|
3
35
|
## 0.3.2 — 2026-12-03
|
|
4
36
|
|
|
5
37
|
### 修复
|
package/README.en.md
CHANGED
|
@@ -36,8 +36,10 @@ The rule is a pure function: `wanted = enabled && (agents + maintenance + jobs >
|
|
|
36
36
|
Three moments each get one cue, played on the machine that runs the DSH host — they reach you even when the window is minimised.
|
|
37
37
|
|
|
38
38
|
- **Done**: one chime per work segment (from work starting to everything finishing), including background jobs and multiple sessions. `Glass` by default.
|
|
39
|
+
- **You pressed stop**: silent. You are at the keyboard, and a "done" chime would be a lie.
|
|
40
|
+
- **Goals / autonomous work**: stage completions stay silent; the whole goal rings once when it disarms; a question or approval in the middle still rings.
|
|
39
41
|
- **Failed**: only when the turn **really errored** (`error`). A stop you pressed, a rejected approval, a subagent wound down by its parent, `max-tokens` or `forked` do not count; when a work segment contains several turns, the **last ordinary-session turn** decides, so a retried success no longer rings the failure cue.
|
|
40
|
-
- **Your turn**: the agent asked a question (`ask_user_question`) or a tool call waits for approval — rings immediately
|
|
42
|
+
- **Your turn**: the agent asked a question (`ask_user_question`) or a tool call waits for approval — rings immediately, `Ping` by default. This is the only cue that can fire while the turn is still open; without it the agent would wait for you in silence. It is detected by reading the Host's `sessionState.pendingInput` every 1.5 seconds (local, no network). One short cue is easy to miss, so it **repeats every 20 seconds until you answer** (capped at 10 minutes) and stops the moment the question is answered.
|
|
41
43
|
- Segments shorter than 20 seconds stay silent; autonomous goal/scheduled rounds stay silent (questions and approvals still ring).
|
|
42
44
|
- The panel's **Sounds** master switch covers all three; three small buttons (Done / Error / Alert) audition each cue.
|
|
43
45
|
- Sound files, volume, the minimum duration and whether questions ring live in `cordis.patch.yml`.
|
|
@@ -176,6 +178,9 @@ Override the row by id in the profile's `cordis.patch.yml`:
|
|
|
176
178
|
soundOnlyUserTasks: true # ignore autonomous rounds
|
|
177
179
|
soundOnQuestion: true # ring when a question/approval waits (no separate toggle)
|
|
178
180
|
questionSound: '' # custom "your turn" sound file (absolute path)
|
|
181
|
+
questionRepeatSeconds: 20 # repeat the cue while unanswered, 0 = once
|
|
182
|
+
questionRepeatMaxMinutes: 10 # longest repeat window
|
|
183
|
+
questionPollMs: 1500 # how often pending human input is checked
|
|
179
184
|
soundVolume: 1 # 0-3, macOS/Linux
|
|
180
185
|
successSound: '' # custom completion file (absolute path)
|
|
181
186
|
errorSound: '' # custom failure file
|
package/README.md
CHANGED
|
@@ -37,7 +37,9 @@ DSH 跑长任务时你离开电脑,系统按空闲策略休眠:进程被挂
|
|
|
37
37
|
|
|
38
38
|
- **完成**:一次「工作段」(从有工作到全部结束)结束时响一次,含后台任务与多会话。默认 `Glass`。
|
|
39
39
|
- **失败**:只有这一轮**真的报错**(`error`)才响,默认 `Basso`。你主动按停止、审批被拒、子代理被父轮次收尾、`max-tokens`/`forked` 这类结束都不算失败;一个工作段里有多个回合时,以**最后一个普通会话回合**的结果为准,重试成功不会还响失败音。
|
|
40
|
-
- **需要你回答**:agent 用 `ask_user_question` 提问、或工具调用等审批时立刻响,默认 `Ping
|
|
40
|
+
- **需要你回答**:agent 用 `ask_user_question` 提问、或工具调用等审批时立刻响,默认 `Ping`——这是唯一一个「回合还没结束也响」的情况,否则它会一直静默等你。检测方式是每 1.5 秒读一次宿主的 `sessionState.pendingInput`(本地、不联网);单声响容易被错过,所以**在你回答之前每 20 秒重复一次**(最多 10 分钟),一旦回答就立刻停。
|
|
41
|
+
- **你主动停止**:静音。你就在键盘前按的停止,不需要"过来看看",也不会再误响完成音。
|
|
42
|
+
- **目标(goal)/自主任务**:阶段完成保持静音;整个 goal 结束(activation 解除)后的那一整段结束才响一次;中途需要你回答/审批时照常响。
|
|
41
43
|
- 短于 20 秒的任务不响;goal/定时任务等自主轮次不响,避免连响(但提问/审批仍然会提醒你)。
|
|
42
44
|
- 弹层「提示音」总开关控制全部三种;旁边三个小按钮「完成 / 失败 / 提醒」可分别试听。
|
|
43
45
|
- 音效文件、音量、最短时长、是否提醒提问在 `cordis.patch.yml` 配置。
|
|
@@ -177,6 +179,9 @@ DSH 默认不带任何索引源。添加本项目随 npm 包发布的索引文
|
|
|
177
179
|
soundOnlyUserTasks: true # 只响用户发起的任务,自主轮次不响
|
|
178
180
|
soundOnQuestion: true # 提问/等待审批时提醒(默认开,无独立开关)
|
|
179
181
|
questionSound: '' # 自定义「提醒」音文件(绝对路径)
|
|
182
|
+
questionRepeatSeconds: 20 # 未回答时每隔多久再响一次,0 = 只响一次
|
|
183
|
+
questionRepeatMaxMinutes: 10 # 最多重复多久
|
|
184
|
+
questionPollMs: 1500 # 多久查一次「是否在等你回答」
|
|
180
185
|
soundVolume: 1 # 0~3,macOS/Linux 生效
|
|
181
186
|
successSound: '' # 自定义完成音文件(绝对路径)
|
|
182
187
|
errorSound: '' # 自定义失败音文件
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -240,6 +240,37 @@
|
|
|
240
240
|
109 → **113 项全绿**;`node --check` 通过。
|
|
241
241
|
- 未验证:真实多代理会话里「成功完成却响失败音」的复现场景需要重启宿主后实测。
|
|
242
242
|
|
|
243
|
+
## 0.3.3 提问提醒改为重复直到回答(2026-12-03)
|
|
244
|
+
|
|
245
|
+
- **现场数据**:宿主为 0.3.2(弹层底部显示 v0.3.2),三个试听音各不相同、链路正常;用户对「提问提示音」的描述是
|
|
246
|
+
「不确定 / 很轻」。结论:功能已生效,但单声 `Ping`(约 0.2 秒)在离开屏幕时太容易被错过。
|
|
247
|
+
- **改法**:提问/审批的 waterfall 监听器在调用 `next()` 前后包一层——先响一次,然后每
|
|
248
|
+
`questionRepeatSeconds`(默认 20s)再响一次,直到 `next()` 结算(用户回答/拒绝)或达到
|
|
249
|
+
`questionRepeatMaxMinutes`(默认 10 分钟)为止;定时器 `unref`,插件卸载或回答后立即清除。
|
|
250
|
+
- 自动化:新增 2 项(未回答时重复 ≥3 次、回答后停止;配置默认 20s/10min 与钳制),单测 113 → **115 全绿**。
|
|
251
|
+
- 未验证:真实「离开屏幕时能否被提醒到」的听感需重启宿主后实测。
|
|
252
|
+
|
|
253
|
+
- 关于「重启后试听点两次才出声」:定位为宿主重启后路由注册完成前的初始化窗口(首次点击落空),
|
|
254
|
+
不是试听逻辑需要两次;`test-sound` 始终以 `force: true` 绕过节流。
|
|
255
|
+
|
|
256
|
+
## 0.3.4 提醒音改用状态轮询、停止静音、目标只响结束(2026-12-03)
|
|
257
|
+
|
|
258
|
+
- **现场**:用户报告「有问题要回答时根本没有声音」。排查结论(读源码):
|
|
259
|
+
- `dsh-api-remotes` 用 `ctx.on` 注册 `user-questions/request` / `approval/request` 的 forwarder,它在
|
|
260
|
+
`dsh.profile.bundles` 里排在 bundle 顺序的前面(base → web-app → 本插件),因此先于本插件注册;
|
|
261
|
+
- waterfall 的语义是监听器调用 `next()` 才继续下一位,而 Web 桥把问题转发给浏览器并**直接返回答案**,
|
|
262
|
+
不再调用 `next()` → 注册在其后的本插件监听器**永远不会执行**。这解释了「试听有声音、提问没声音」。
|
|
263
|
+
- **改法**:轮询宿主 `sessionController.state({ sessionId }).pendingInput`,它由宿主自己根据
|
|
264
|
+
`approval/request` / `user-questions/request` 维护(`dsh-api-session-controller/src/state/controller.ts`),
|
|
265
|
+
与监听顺序无关;默认 1.5 秒一次、只读本地状态。检测到 `question|approval|other` → 响一次并每 20 秒重复,
|
|
266
|
+
状态清空立即停止。
|
|
267
|
+
- **手动停止**:`aborted` / `blocked` / `interrupted` / `max-tokens` / `forked` 归为 `silent`,不再响完成音。
|
|
268
|
+
- **目标(goal)**:监听 `goal/activation-changed`;armed 期间阶段完成静音,解除后的整段结束响一次
|
|
269
|
+
(成功/失败取决于最后回合),中途提问照响(不受 goal 静音影响,也不受 `soundOnlyUserTasks` 限制)。
|
|
270
|
+
- 自动化:接线测试新增 5 项(轮询 question/approval、子代理会话、重复与停止、手动停止、goal 三态),
|
|
271
|
+
115 → **120 全绿**。
|
|
272
|
+
- 未验证:真实 UI 上「提问时能听到 Ping、回答后停止」与真实 goal 结束那一声,需要重启宿主后实测。
|
|
273
|
+
|
|
243
274
|
## 未验证(明确记录,不代替验证)
|
|
244
275
|
|
|
245
276
|
| ID / 项 | 原因 | 何时可验 |
|
package/index.js
CHANGED
|
@@ -99,20 +99,33 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
99
99
|
let wasWorking = false
|
|
100
100
|
let workStartedAt = 0
|
|
101
101
|
let pendingUserSound = false
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
/**
|
|
103
|
+
* How this segment ended: `done` rings the completion cue, `error` the failure
|
|
104
|
+
* cue, and `silent` rings nothing. A stop you pressed, a blocked guard, a
|
|
105
|
+
* `max-tokens` or `forked` ending are neither success nor failure, so they
|
|
106
|
+
* must not claim "done" — DSH's own chat view shows no failure row for them
|
|
107
|
+
* either.
|
|
108
|
+
*/
|
|
109
|
+
let lastEnding = 'done'
|
|
110
|
+
/** Session that produced `lastEnding`; a goal there silences its stage edges. */
|
|
111
|
+
let lastEndingSession = null
|
|
112
|
+
/** Sessions whose goal is armed (the autonomous loop keeps running turns). */
|
|
113
|
+
const goalSessions = new Set()
|
|
114
|
+
/** A goal disarmed during this segment: its completion rings once at the end. */
|
|
115
|
+
let goalJustFinished = false
|
|
109
116
|
|
|
110
117
|
function maybeRing(durationMs) {
|
|
111
118
|
try {
|
|
112
119
|
if (!config.enabled || !config.sound) return
|
|
113
|
-
if (
|
|
120
|
+
if (lastEnding === 'silent') return
|
|
121
|
+
// A goal continues turn after turn; its stage edges stay silent and only
|
|
122
|
+
// the segment after the disarm rings, so "goal finished" is heard once.
|
|
123
|
+
const goalRunning = lastEndingSession !== null && goalSessions.has(lastEndingSession)
|
|
124
|
+
if (goalRunning && !goalJustFinished) return
|
|
125
|
+
const goalEnded = goalJustFinished
|
|
126
|
+
if (!goalEnded && config.soundOnlyUserTasks && !pendingUserSound) return
|
|
114
127
|
if (config.soundMinSeconds > 0 && durationMs < config.soundMinSeconds * 1000) return
|
|
115
|
-
const kind = config.soundOnError &&
|
|
128
|
+
const kind = config.soundOnError && lastEnding === 'error' ? 'error' : 'success'
|
|
116
129
|
sound.play(kind)
|
|
117
130
|
} catch (error) {
|
|
118
131
|
log.warn(`stay-awake: notification sound failed: ${describe(error)}`)
|
|
@@ -162,9 +175,12 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
162
175
|
|
|
163
176
|
// ---- "your turn": the agent is waiting for an answer or an approval ----
|
|
164
177
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
178
|
+
* Why this polls instead of listening to the waterfall events: the web
|
|
179
|
+
* bridge that answers `user-questions/request` / `approval/request` is
|
|
180
|
+
* registered before this plugin, and a waterfall listener that answers does
|
|
181
|
+
* not call `next()`, so a later listener never runs. The Host's passive
|
|
182
|
+
* `sessionState.pendingInput` carries exactly the same fact and does not
|
|
183
|
+
* depend on listener order.
|
|
168
184
|
*/
|
|
169
185
|
const ringQuestion = () => {
|
|
170
186
|
try {
|
|
@@ -175,16 +191,121 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
175
191
|
}
|
|
176
192
|
}
|
|
177
193
|
|
|
194
|
+
let attentionTimer = null
|
|
195
|
+
let attentionSince = 0
|
|
196
|
+
let attentionActive = false
|
|
197
|
+
|
|
198
|
+
function stopAttentionRepeats() {
|
|
199
|
+
if (attentionTimer !== null && typeof clearInterval === 'function') clearInterval(attentionTimer)
|
|
200
|
+
attentionTimer = null
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* A single short cue is easy to miss while the user is away, so the alert
|
|
205
|
+
* repeats while anything still waits for a human and stops the moment the
|
|
206
|
+
* state clears.
|
|
207
|
+
* @param {boolean} active
|
|
208
|
+
*/
|
|
209
|
+
function setAttention(active) {
|
|
210
|
+
if (active === attentionActive) return
|
|
211
|
+
attentionActive = active
|
|
212
|
+
if (!active) {
|
|
213
|
+
attentionSince = 0
|
|
214
|
+
stopAttentionRepeats()
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
attentionSince = clockNow()
|
|
218
|
+
ringQuestion()
|
|
219
|
+
const repeatMs = Number(config.questionRepeatSeconds) * 1_000
|
|
220
|
+
const maxMs = Number(config.questionRepeatMaxMinutes) * 60_000
|
|
221
|
+
if (!(repeatMs > 0) || !(maxMs > 0) || typeof setInterval !== 'function') return
|
|
222
|
+
stopAttentionRepeats()
|
|
223
|
+
attentionTimer = setInterval(() => {
|
|
224
|
+
if (clockNow() - attentionSince >= maxMs) {
|
|
225
|
+
stopAttentionRepeats()
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
ringQuestion()
|
|
229
|
+
}, repeatMs)
|
|
230
|
+
if (typeof attentionTimer.unref === 'function') attentionTimer.unref()
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async function pollHumanInput() {
|
|
234
|
+
if (!config.enabled || !config.sound || config.soundOnQuestion !== true) {
|
|
235
|
+
setAttention(false)
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
const sessionController = ctx.get('sessionController')
|
|
239
|
+
if (sessionController === undefined || sessionController === null
|
|
240
|
+
|| typeof sessionController.state !== 'function') return
|
|
241
|
+
let agents = []
|
|
242
|
+
try {
|
|
243
|
+
agents = ctx.agents.list()
|
|
244
|
+
} catch {
|
|
245
|
+
agents = []
|
|
246
|
+
}
|
|
247
|
+
let pending = false
|
|
248
|
+
for (const agent of agents) {
|
|
249
|
+
const session = agent?.session
|
|
250
|
+
if (session === undefined || session === null) continue
|
|
251
|
+
try {
|
|
252
|
+
const state = await sessionController.state({ sessionId: session.id })
|
|
253
|
+
const input = Array.isArray(state?.pendingInput) ? state.pendingInput : []
|
|
254
|
+
if (input.includes('question') || input.includes('approval') || input.includes('other')) {
|
|
255
|
+
pending = true
|
|
256
|
+
break
|
|
257
|
+
}
|
|
258
|
+
} catch {
|
|
259
|
+
// A cold or disposed session answers nothing; keep looking at the rest.
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
setAttention(pending)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
ctx.effect(() => {
|
|
266
|
+
const timer = setInterval(() => {
|
|
267
|
+
Promise.resolve(pollHumanInput()).catch(() => {})
|
|
268
|
+
}, Number(config.questionPollMs) || 1_500)
|
|
269
|
+
if (typeof timer.unref === 'function') timer.unref()
|
|
270
|
+
return () => {
|
|
271
|
+
clearInterval(timer)
|
|
272
|
+
setAttention(false)
|
|
273
|
+
}
|
|
274
|
+
}, 'stay-awake: human attention')
|
|
275
|
+
|
|
276
|
+
// A goal keeps the turn loop going; its disarm is the moment the whole
|
|
277
|
+
// autonomous run is over, so that segment may ring even without a user prompt.
|
|
278
|
+
ctx.effect(() => {
|
|
279
|
+
try {
|
|
280
|
+
return ctx.on('goal/activation-changed', (payload) => {
|
|
281
|
+
const sessionId = payload?.sessionId
|
|
282
|
+
if (typeof sessionId !== 'string') return
|
|
283
|
+
if (payload?.goal?.activation === 'armed') {
|
|
284
|
+
goalSessions.add(sessionId)
|
|
285
|
+
return
|
|
286
|
+
}
|
|
287
|
+
if (goalSessions.delete(sessionId)) goalJustFinished = true
|
|
288
|
+
})
|
|
289
|
+
} catch (error) {
|
|
290
|
+
log.warn(`stay-awake: could not subscribe to goal/activation-changed: ${describe(error)}`)
|
|
291
|
+
return () => {}
|
|
292
|
+
}
|
|
293
|
+
}, 'stay-awake: goal activation')
|
|
294
|
+
|
|
178
295
|
const sync = () => {
|
|
179
296
|
const working = activity.hasWork(config)
|
|
180
297
|
if (working && !wasWorking) {
|
|
181
298
|
workStartedAt = clockNow()
|
|
182
|
-
|
|
299
|
+
lastEnding = 'done'
|
|
300
|
+
lastEndingSession = null
|
|
301
|
+
goalJustFinished = false
|
|
183
302
|
}
|
|
184
303
|
if (!working && wasWorking) {
|
|
185
304
|
maybeRing(clockNow() - workStartedAt)
|
|
186
305
|
pendingUserSound = false
|
|
187
|
-
|
|
306
|
+
lastEnding = 'done'
|
|
307
|
+
lastEndingSession = null
|
|
308
|
+
goalJustFinished = false
|
|
188
309
|
}
|
|
189
310
|
wasWorking = working
|
|
190
311
|
controller.update(activity.counts(config))
|
|
@@ -232,7 +353,11 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
232
353
|
if (event?.type === 'turn/end') {
|
|
233
354
|
// The *last* ordinary turn decides the cue: a failure the user then
|
|
234
355
|
// retried into a success must not keep the failure sound.
|
|
235
|
-
if (ordinary)
|
|
356
|
+
if (ordinary) {
|
|
357
|
+
const kind = event.data?.reason?.kind
|
|
358
|
+
lastEnding = kind === 'error' ? 'error' : kind === 'completed' ? 'done' : 'silent'
|
|
359
|
+
lastEndingSession = session?.id ?? null
|
|
360
|
+
}
|
|
236
361
|
return
|
|
237
362
|
}
|
|
238
363
|
if (config.includeMaintenance !== true) return
|
|
@@ -256,30 +381,6 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
256
381
|
}
|
|
257
382
|
}, 'stay-awake: activity sources')
|
|
258
383
|
|
|
259
|
-
ctx.effect(() => {
|
|
260
|
-
const listen = (name) => {
|
|
261
|
-
try {
|
|
262
|
-
return ctx.on(name, (_payload, next) => {
|
|
263
|
-
ringQuestion()
|
|
264
|
-
return typeof next === 'function' ? next() : undefined
|
|
265
|
-
})
|
|
266
|
-
} catch (error) {
|
|
267
|
-
log.warn(`stay-awake: could not subscribe to ${name}: ${describe(error)}`)
|
|
268
|
-
return () => {}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
const disposers = [listen('user-questions/request'), listen('approval/request')]
|
|
272
|
-
return () => {
|
|
273
|
-
for (const dispose of disposers) {
|
|
274
|
-
try {
|
|
275
|
-
dispose()
|
|
276
|
-
} catch {
|
|
277
|
-
// Unloading is best effort.
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}, 'stay-awake: question sound')
|
|
282
|
-
|
|
283
384
|
const jobs = ctx.get('jobs')
|
|
284
385
|
if (jobs !== undefined && jobs !== null && config.includeBackgroundJobs) {
|
|
285
386
|
ctx.effect(() => {
|
package/lib/config.js
CHANGED
|
@@ -26,6 +26,13 @@ export const DEFAULTS = Object.freeze({
|
|
|
26
26
|
errorSound: '',
|
|
27
27
|
questionSound: '',
|
|
28
28
|
soundOnQuestion: true,
|
|
29
|
+
// "Your turn" is easy to miss with a single short cue, so the alert repeats
|
|
30
|
+
// while the question or approval is still waiting for the human.
|
|
31
|
+
questionRepeatSeconds: 20,
|
|
32
|
+
questionRepeatMaxMinutes: 10,
|
|
33
|
+
// How often the host asks its own session state whether a human answer is
|
|
34
|
+
// pending. Cheap, local, and it sees approvals the waterfall bridge answers.
|
|
35
|
+
questionPollMs: 1500,
|
|
29
36
|
soundVolume: 1,
|
|
30
37
|
// "Retry the turn that died with the network": on by default, but it only
|
|
31
38
|
// fires for a lost connection, never for a user abort or an approval wait.
|
|
@@ -108,6 +115,9 @@ export function normalizeConfig(raw) {
|
|
|
108
115
|
errorSound: asOptionalPath(input.errorSound),
|
|
109
116
|
questionSound: asOptionalPath(input.questionSound),
|
|
110
117
|
soundOnQuestion: asBoolean(input.soundOnQuestion, DEFAULTS.soundOnQuestion),
|
|
118
|
+
questionRepeatSeconds: asNumber(input.questionRepeatSeconds, DEFAULTS.questionRepeatSeconds, { min: 0, max: 60 * 30 }),
|
|
119
|
+
questionRepeatMaxMinutes: asNumber(input.questionRepeatMaxMinutes, DEFAULTS.questionRepeatMaxMinutes, { min: 0, max: 24 * 60 }),
|
|
120
|
+
questionPollMs: asNumber(input.questionPollMs, DEFAULTS.questionPollMs, { min: 200, max: 10_000 }),
|
|
111
121
|
soundVolume: asNumber(input.soundVolume, DEFAULTS.soundVolume, { min: 0, max: 3 }),
|
|
112
122
|
autoResume: asBoolean(input.autoResume, DEFAULTS.autoResume),
|
|
113
123
|
autoResumeCodes: asCodes(input.autoResumeCodes, DEFAULTS.autoResumeCodes),
|
package/market/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laraveladmin/dsh-stay-awake",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
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",
|