@laraveladmin/dsh-stay-awake 0.3.2 → 0.3.3

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.3.3 — 2026-12-03
4
+
5
+ ### 改进
6
+
7
+ - 「需要你回答」的提醒音改为**重复提醒直到你回答**:默认每 20 秒响一次、最多 10 分钟,问题被回答后立刻停止
8
+ (监听 waterfall 的 `next()` 结算来取消)。单声 `Ping` 太短太轻,离开屏幕时很容易错过。
9
+ - 新增配置 `questionRepeatSeconds`(默认 20,0 = 只响一次)与 `questionRepeatMaxMinutes`(默认 10)。
10
+ - 新增 2 项测试:未回答时确实重复、回答后停止;配置默认值与钳制。单测 113 → 115。
11
+
12
+ ### 说明
13
+
14
+ - 关于「重启后试听要点两次才出声」:宿主重启后的头几秒插件路由才注册完成,第一次点击可能落在宿主初始化窗口里;
15
+ 插件本身每次点击都会带 `force` 绕过 1 秒节流,不存在需要点两次的逻辑。
16
+
17
+
3
18
  ## 0.3.2 — 2026-12-03
4
19
 
5
20
  ### 修复
package/README.en.md CHANGED
@@ -37,7 +37,7 @@ Three moments each get one cue, played on the machine that runs the DSH host —
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
39
  - **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. `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.
40
+ - **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. 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
41
  - Segments shorter than 20 seconds stay silent; autonomous goal/scheduled rounds stay silent (questions and approvals still ring).
42
42
  - The panel's **Sounds** master switch covers all three; three small buttons (Done / Error / Alert) audition each cue.
43
43
  - Sound files, volume, the minimum duration and whether questions ring live in `cordis.patch.yml`.
@@ -176,6 +176,8 @@ Override the row by id in the profile's `cordis.patch.yml`:
176
176
  soundOnlyUserTasks: true # ignore autonomous rounds
177
177
  soundOnQuestion: true # ring when a question/approval waits (no separate toggle)
178
178
  questionSound: '' # custom "your turn" sound file (absolute path)
179
+ questionRepeatSeconds: 20 # repeat the cue while unanswered, 0 = once
180
+ questionRepeatMaxMinutes: 10 # longest repeat window
179
181
  soundVolume: 1 # 0-3, macOS/Linux
180
182
  successSound: '' # custom completion file (absolute path)
181
183
  errorSound: '' # custom failure file
package/README.md CHANGED
@@ -37,7 +37,7 @@ 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`——这是唯一一个「回合还没结束也响」的情况,否则它会一直静默等你。单声响很容易被错过,所以**在你回答之前每 20 秒重复一次**(最多 10 分钟),一旦回答就立刻停。
41
41
  - 短于 20 秒的任务不响;goal/定时任务等自主轮次不响,避免连响(但提问/审批仍然会提醒你)。
42
42
  - 弹层「提示音」总开关控制全部三种;旁边三个小按钮「完成 / 失败 / 提醒」可分别试听。
43
43
  - 音效文件、音量、最短时长、是否提醒提问在 `cordis.patch.yml` 配置。
@@ -177,6 +177,8 @@ DSH 默认不带任何索引源。添加本项目随 npm 包发布的索引文
177
177
  soundOnlyUserTasks: true # 只响用户发起的任务,自主轮次不响
178
178
  soundOnQuestion: true # 提问/等待审批时提醒(默认开,无独立开关)
179
179
  questionSound: '' # 自定义「提醒」音文件(绝对路径)
180
+ questionRepeatSeconds: 20 # 未回答时每隔多久再响一次,0 = 只响一次
181
+ questionRepeatMaxMinutes: 10 # 最多重复多久
180
182
  soundVolume: 1 # 0~3,macOS/Linux 生效
181
183
  successSound: '' # 自定义完成音文件(绝对路径)
182
184
  errorSound: '' # 自定义失败音文件
@@ -240,6 +240,19 @@
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
+
243
256
  ## 未验证(明确记录,不代替验证)
244
257
 
245
258
  | ID / 项 | 原因 | 何时可验 |
package/index.js CHANGED
@@ -175,6 +175,29 @@ export function start(ctx, rawConfig, deps = {}) {
175
175
  }
176
176
  }
177
177
 
178
+ /**
179
+ * A single short cue is easy to miss when the user is away from the screen,
180
+ * so the alert repeats while the question or approval is still unanswered and
181
+ * stops the moment it is answered (the waterfall result settles).
182
+ * @returns {() => void} stop the repeats
183
+ */
184
+ function startQuestionReminder() {
185
+ ringQuestion()
186
+ const repeatMs = Number(config.questionRepeatSeconds) * 1_000
187
+ const maxMs = Number(config.questionRepeatMaxMinutes) * 60_000
188
+ if (!(repeatMs > 0) || !(maxMs > 0) || typeof setInterval !== 'function') return () => {}
189
+ const deadline = clockNow() + maxMs
190
+ const timer = setInterval(() => {
191
+ if (clockNow() >= deadline) {
192
+ clearInterval(timer)
193
+ return
194
+ }
195
+ ringQuestion()
196
+ }, repeatMs)
197
+ if (typeof timer.unref === 'function') timer.unref()
198
+ return () => clearInterval(timer)
199
+ }
200
+
178
201
  const sync = () => {
179
202
  const working = activity.hasWork(config)
180
203
  if (working && !wasWorking) {
@@ -259,9 +282,13 @@ export function start(ctx, rawConfig, deps = {}) {
259
282
  ctx.effect(() => {
260
283
  const listen = (name) => {
261
284
  try {
262
- return ctx.on(name, (_payload, next) => {
263
- ringQuestion()
264
- return typeof next === 'function' ? next() : undefined
285
+ return ctx.on(name, async (_payload, next) => {
286
+ const stop = startQuestionReminder()
287
+ try {
288
+ return typeof next === 'function' ? await next() : undefined
289
+ } finally {
290
+ stop()
291
+ }
265
292
  })
266
293
  } catch (error) {
267
294
  log.warn(`stay-awake: could not subscribe to ${name}: ${describe(error)}`)
package/lib/config.js CHANGED
@@ -26,6 +26,10 @@ 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,
29
33
  soundVolume: 1,
30
34
  // "Retry the turn that died with the network": on by default, but it only
31
35
  // fires for a lost connection, never for a user abort or an approval wait.
@@ -108,6 +112,8 @@ export function normalizeConfig(raw) {
108
112
  errorSound: asOptionalPath(input.errorSound),
109
113
  questionSound: asOptionalPath(input.questionSound),
110
114
  soundOnQuestion: asBoolean(input.soundOnQuestion, DEFAULTS.soundOnQuestion),
115
+ questionRepeatSeconds: asNumber(input.questionRepeatSeconds, DEFAULTS.questionRepeatSeconds, { min: 0, max: 60 * 30 }),
116
+ questionRepeatMaxMinutes: asNumber(input.questionRepeatMaxMinutes, DEFAULTS.questionRepeatMaxMinutes, { min: 0, max: 24 * 60 }),
111
117
  soundVolume: asNumber(input.soundVolume, DEFAULTS.soundVolume, { min: 0, max: 3 }),
112
118
  autoResume: asBoolean(input.autoResume, DEFAULTS.autoResume),
113
119
  autoResumeCodes: asCodes(input.autoResumeCodes, DEFAULTS.autoResumeCodes),
package/market/index.json CHANGED
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "versions": [
53
53
  {
54
- "version": "0.3.2",
55
- "publishTimestamp": 1796350760,
54
+ "version": "0.3.3",
55
+ "publishTimestamp": 1796365892,
56
56
  "source": {
57
57
  "type": "npm"
58
58
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laraveladmin/dsh-stay-awake",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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",