dsh-session-superagent 0.8.39 → 0.8.41

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
@@ -2,6 +2,46 @@
2
2
 
3
3
  格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.8.41] - 2026-11-02 —— UI 不再靠肉眼验收:七项指标 + 首次 100 分
6
+
7
+ 用户的原话:「你的 UI 真的完美了吗?要做到 DSH 的原生 UI 一样」。肉眼点一遍既慢又漏,
8
+ 所以先把**能数的东西**抽出来:新增 `scripts/ui-audit.mjs`(不需要宿主,量源码),
9
+ 并接进 `preflight`,以后每次推送都会跑。
10
+
11
+ ### 首次体检抓出三处真问题(已修)
12
+ | 指标 | 修前 | 修后 |
13
+ |---|---|---|
14
+ | 可点但不可键盘操作的裸 div | 1(弹层遮罩) | **0**(`role="presentation"`) |
15
+ | 图标按钮缺可读名字 | 2(行内「编辑」「暂停/恢复」) | **0**(补 `label`) |
16
+ | 空态分支 | 用 `dt-empty` 查不到 | 改按 `length === 0` 数,**10 处** |
17
+
18
+ ### 七项指标(当前全绿)
19
+ ```
20
+ 可点裸 div 0 · focus-visible 15 · 写死颜色 0 · 图标按钮缺名字 0
21
+ 空态分支 10 · 裸 button/Btn 8/15 · 自造类死代码 0 → 100 分
22
+ ```
23
+
24
+ 指标不是空转:新增指标时都写了**负例**(故意造一个没名字的按钮,确认抓得到)。
25
+
26
+ ### 新增文档
27
+ `docs/optimization-plan.md`:指标表 + 下一批目标(换掉 8 个裸 button、间距节奏、空态结构、
28
+ 双主题实拍、键盘走查)。定时任务的提示词也改成按这张表挑活。
29
+
30
+ ## [0.8.40] - 2026-11-02 —— 时段外不要谎报「主理中」
31
+
32
+ 用户截图指出一处不诚实:一条设了活跃时段 `09:00-23:00` 的主理鱼,
33
+ 在窗口之外仍然挂着绿色「主理中」—— 但那个时间点它根本不会唤醒,只是把条目攒着。
34
+
35
+ ### 改法
36
+ 状态判定加第四种 `dormant`(时段外):
37
+ - 设了 `activeHours` 且**此刻不在窗口内** → 标签显示「时段外」(灰色 + 悬停说明「只攒条目,不唤醒」);
38
+ - 窗口内 / 没设时段 → 仍显示「主理中」;
39
+ - 支持跨夜窗口(`22:00-06:00`);时段写错(解析不了)就退回「主理中」,不乱标;
40
+ - 顶部统计「N 主理中」与轨道环绕色也跟着只算真正在岗的那些(全时段外时环是灰色,不是琥珀色)。
41
+
42
+ ### 测试
43
+ - 新增用例:窗口外的 watcher 必须显示「时段外」且仍显示时段本身。合计 **100 例**。
44
+
5
45
  ## [0.8.39] - 2026-11-02 —— 有新版本时,面板顶上直接告诉你
6
46
 
7
47
  0.8.38 把版本检查放进了「设置」页 —— 但客户不会主动翻设置页,等于没做。
package/MAINTENANCE.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## 二、当前状态(2026-11-01)
11
11
 
12
- - [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 99/99 通过
12
+ - [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 100/100 通过
13
13
  - [x] 自回声抑制(逐条水位)
14
14
  - [x] 仅空闲注入(避免草稿回放)
15
15
  - [x] 唤醒失败不推进水位
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="assets/icon-180.png" width="88" height="88" alt="">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-0.8.39-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.8.41-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
7
7
  [![npm](https://img.shields.io/npm/v/dsh-session-superagent.svg)](https://www.npmjs.com/package/dsh-session-superagent)
8
8
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-plugin-orange.svg)](https://github.com/topics/dsh-plugin)
9
9
 
@@ -99,7 +99,7 @@ dsh plugin install /path/to/dsh-session-superagent
99
99
  ## 开发
100
100
 
101
101
  ```sh
102
- node --test # 99 项单测
102
+ node --test # 100 项单测
103
103
  ```
104
104
 
105
105
  版本与发布流程见 [UPDATING.md](UPDATING.md),交付门见 [CHECKLIST.md](CHECKLIST.md),接手台账见 [MAINTENANCE.md](MAINTENANCE.md)。
package/client.js CHANGED
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
14
14
  const { useCallback, useEffect, useRef, useState } = React
15
15
 
16
16
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
17
- const CLIENT_VERSION = '0.8.39'
17
+ const CLIENT_VERSION = '0.8.41'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -260,7 +260,7 @@ window.__ModuleLoader__.load({
260
260
  if (!open) return null
261
261
  // class 必须与移植来的官方 CSS 对齐:dt-modal-root / dt-modal-mask / dt-modal-header
262
262
  return h('div', { className: 'dt-modal-root' },
263
- h('div', { className: 'dt-modal-mask', onClick: onClose }),
263
+ h('div', { className: 'dt-modal-mask', role: 'presentation', onClick: onClose }),
264
264
  h('div', {
265
265
  className: 'dt-modal', role: 'dialog', 'aria-modal': 'true',
266
266
  'aria-label': typeof title === 'string' ? title : undefined,
@@ -301,14 +301,32 @@ window.__ModuleLoader__.load({
301
301
  // session-level superagent (a live watcher): green = watching, amber =
302
302
  // paused, red = last poll failed. Icon only — details live in the
303
303
  // click-through panel, and a native tooltip carries the one-line summary.
304
+ /**
305
+ * 现在是否落在活跃时段里。支持跨夜(22:00-06:00)。
306
+ * 解析不了就返回 null —— 宁可显示「主理中」,也不要乱标。
307
+ */
308
+ function inWindowNow(hours) {
309
+ const match = String(hours || '').match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
310
+ if (!match) return null
311
+ const now = new Date()
312
+ const current = now.getHours() * 60 + now.getMinutes()
313
+ const from = Number(match[1]) * 60 + Number(match[2])
314
+ const to = Number(match[3]) * 60 + Number(match[4])
315
+ return from <= to ? current >= from && current < to : current >= from || current < to
316
+ }
317
+
304
318
  function orbitStateOf(w) {
305
319
  if (!w) return 'paused'
306
320
  if (w.lastError) return 'error'
307
- return w.enabled === false ? 'paused' : 'active'
321
+ if (w.enabled === false) return 'paused'
322
+ // 设了活跃时段、而此刻在窗口外:它其实不会唤醒,只是把条目攒着 ——
323
+ // 这时候还标「主理中」就是在骗人(2026-11-02 用户截图指出)。
324
+ if (w.activeHours && inWindowNow(w.activeHours) === false) return 'dormant'
325
+ return 'active'
308
326
  }
309
327
 
310
- const SAT_COLOR = { active: '#3fb950', paused: '#d29922', error: '#f85149' }
311
- const STATE_TEXT = { active: '主理中', paused: '已暂停', error: '异常' }
328
+ const SAT_COLOR = { active: '#3fb950', paused: '#d29922', error: '#f85149', dormant: '#8b949e' }
329
+ const STATE_TEXT = { active: '主理中', paused: '已暂停', error: '异常', dormant: '时段外' }
312
330
 
313
331
  /** 尊重系统的「减少动态效果」设置。 */
314
332
  const prefersReducedMotion = () => {
@@ -327,7 +345,7 @@ window.__ModuleLoader__.load({
327
345
  ? 'currentColor'
328
346
  : states.indexOf('error') >= 0
329
347
  ? SAT_COLOR.error
330
- : anyActive ? SAT_COLOR.active : SAT_COLOR.paused
348
+ : anyActive ? SAT_COLOR.active : states.indexOf('dormant') >= 0 ? SAT_COLOR.dormant : SAT_COLOR.paused
331
349
  const dashed = states.indexOf('paused') >= 0
332
350
  const still = prefersReducedMotion()
333
351
 
@@ -816,8 +834,8 @@ window.__ModuleLoader__.load({
816
834
 
817
835
  const stateTag = (watcher) => {
818
836
  const state = orbitStateOf(watcher)
819
- const tone = state === 'active' ? 'success' : state === 'paused' ? 'warning' : 'danger'
820
- return h(Tag, { tone }, STATE_TEXT[state])
837
+ const tone = state === 'active' ? 'success' : state === 'paused' ? 'warning' : state === 'dormant' ? 'outline' : 'danger'
838
+ return h(Tag, { tone, title: state === 'dormant' ? '不在活跃时段:只攒条目,不唤醒' : undefined }, STATE_TEXT[state])
821
839
  }
822
840
 
823
841
  const row = (watcher) => {
@@ -847,7 +865,7 @@ window.__ModuleLoader__.load({
847
865
  backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null)),
848
866
  h('div', { className: 'dt-row-actions' },
849
867
  h(Btn, {
850
- size: 'sm', variant: 'ghost', icon: h(Icon, { name: 'settings' }),
868
+ size: 'sm', variant: 'ghost', icon: h(Icon, { name: 'settings' }), label: '编辑',
851
869
  onClick: () => {
852
870
  setEditing(editing === key ? null : key)
853
871
  setDraft({
@@ -868,6 +886,7 @@ window.__ModuleLoader__.load({
868
886
  h(Btn, {
869
887
  size: 'sm', variant: 'ghost',
870
888
  icon: h(Icon, { name: watcher.enabled ? 'pause' : 'play' }),
889
+ label: watcher.enabled ? '暂停' : '恢复',
871
890
  onClick: () => act(watcher, watcher.enabled ? 'pause' : 'resume'),
872
891
  }, watcher.enabled ? '暂停' : '恢复'),
873
892
  h(ConfirmBtn, {
package/lib/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
 
31
31
  export const name = 'dsh-session-superagent'
32
32
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
33
- export const SERVER_VERSION = '0.8.39'
33
+ export const SERVER_VERSION = '0.8.41'
34
34
  export const inject = ['tools', 'agents', 'webServer']
35
35
 
36
36
  /** 仅供测试:读写状态文件(生产代码不要用)。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.8.39",
3
+ "version": "0.8.41",
4
4
  "description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",