dsh-session-superagent 0.8.75 → 0.8.77

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,40 @@
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.77] - 2026-11-02 —— 标出"未认领",但不偷偷加权
6
+
7
+ ### 学到的(知识库第 26 条)
8
+ GitHub 只给事实(`assignees` 是谁),不给"因此谁更紧急"的判断。
9
+ <b>「无人认领更紧急」是团队经验</b>,本轮没找到官方依据 —— 所以它不该进默认权重。
10
+
11
+ ### 改了什么
12
+ - 唤醒消息里给无人认领的条目加一句 **`未认领`**(事实,不需要理由);
13
+ - 面板新增「未认领优先」开关(+3 分),**默认关闭** —— 想用的人自己开。
14
+
15
+ 分寸:**事实默认展示,判断默认关闭。**
16
+
17
+ ### 测试
18
+ - 新增 1 例(null/有指派/空数组/缺字段、消息标注、默认 0 分、开启 +3、已认领不加分)。合计 **129 例**。
19
+
20
+ ## [0.8.76] - 2026-11-02 —— 优先级权重可关掉(因为它是产品判断,不是标准)
21
+
22
+ ### 诚实说明(知识库第 25 条)
23
+ GitHub 提供 `sort=created|updated|comments`,但**没有官方推荐的"权重"**。
24
+ 本轮想找 triage 优先级的官方说明时页面 404 / 抓不到正文 ——
25
+ 所以 100/10/5 这套权重**是我们自己的产品判断**,不是抄的行业标准。
26
+
27
+ 既然是自己拍的,就该让用户能关掉。
28
+
29
+ ### 改了什么
30
+ - 每条守存 `priority: { reopened, comments, labels }`(默认全开);
31
+ - 面板「编辑」页三个开关:重开优先 / 评论优先 / 标签优先;
32
+ - **三项全关 = 退回 GitHub 的 updated 顺序**(仍是稳定排序,不会乱跳);
33
+ - `/state` 回传 `priority`,`/watch` 接受 `priority`。
34
+
35
+ ### 测试
36
+ - 新增 1 例(全开/关一项/全关/权重不受开关影响)。合计 **128 例**;
37
+ - 源码级守门里补了 3 个新字段(编辑态回填必须列全)。
38
+
5
39
  ## [0.8.75] - 2026-11-02 —— 一次 N 条时,先处理更该处理的
6
40
 
7
41
  ### 学到的(知识库第 24 条)
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` 127/127 通过
12
+ - [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 129/129 通过
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.75-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.8.77-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 # 127 项单测
102
+ node --test # 129 项单测
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.75'
17
+ const CLIENT_VERSION = '0.8.77'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -905,6 +905,12 @@ window.__ModuleLoader__.load({
905
905
  workdir: draft.workdir || '',
906
906
  observe: !!draft.observe,
907
907
  isolateKeepDays: Number(draft.isolateKeepDays) || undefined,
908
+ priority: {
909
+ reopened: draft.priorityReopened !== false,
910
+ comments: draft.priorityComments !== false,
911
+ labels: draft.priorityLabels !== false,
912
+ unassigned: draft.priorityUnassigned === true,
913
+ },
908
914
  batchLimit: Number(draft.batchLimit) || undefined,
909
915
  maxWakesPerHour: Number(draft.maxWakesPerHour) || undefined,
910
916
  }),
@@ -999,6 +1005,10 @@ window.__ModuleLoader__.load({
999
1005
  batchLimit: watcher.batchLimit ? String(watcher.batchLimit) : '',
1000
1006
  maxWakesPerHour: watcher.maxWakesPerHour ? String(watcher.maxWakesPerHour) : '',
1001
1007
  isolateKeepDays: watcher.isolateKeepDays ? String(watcher.isolateKeepDays) : '',
1008
+ priorityReopened: (watcher.priority && watcher.priority.reopened) !== false,
1009
+ priorityComments: (watcher.priority && watcher.priority.comments) !== false,
1010
+ priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
1011
+ priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
1002
1012
  })
1003
1013
  },
1004
1014
  }, watcher.repo)),
@@ -1046,6 +1056,11 @@ window.__ModuleLoader__.load({
1046
1056
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.onlyAssigned, onChange: (v) => setDraft({ ...draft, onlyAssigned: v }), label: '只看已指派' }), '只处理已指派给人的条目'),
1047
1057
  field('单次最多唤醒条数', h(Input, { value: draft.batchLimit || '', placeholder: '5(1-20)', onChange: (e) => setDraft({ ...draft, batchLimit: e.target.value }) })),
1048
1058
  field('每小时最多唤醒次数', h(Input, { value: draft.maxWakesPerHour || '', placeholder: '6(1-60)', onChange: (e) => setDraft({ ...draft, maxWakesPerHour: e.target.value }) })),
1059
+ field('优先级(一次只处理 N 条时先挑谁)', h('div', { className: 'dt-actions' },
1060
+ h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityReopened !== false, onChange: (v) => setDraft({ ...draft, priorityReopened: v }), label: '重开优先' }), '被重开的排最前'),
1061
+ h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityComments !== false, onChange: (v) => setDraft({ ...draft, priorityComments: v }), label: '评论优先' }), '有人在等回应的靠前'),
1062
+ h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityLabels !== false, onChange: (v) => setDraft({ ...draft, priorityLabels: v }), label: '标签优先' }), '带标签的靠前'),
1063
+ h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityUnassigned === true, onChange: (v) => setDraft({ ...draft, priorityUnassigned: v }), label: '未认领优先' }), '没人认领的靠前(默认关:这是我们的判断,不是规则)')), '全部关掉时按 GitHub 的「最近更新」顺序处理'),
1049
1064
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.observe, onChange: (v) => setDraft({ ...draft, observe: v }), label: '仅观察' }), '仅观察(只记录不唤醒)'),
1050
1065
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.isolated, onChange: (v) => setDraft({ ...draft, isolated: v }), label: '隔离执行' }), '隔离执行(每次唤醒开一次性 worktree)'),
1051
1066
  draft.isolated ? field('隔离工作目录', h(Input, { value: draft.workdir || '', placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setDraft({ ...draft, workdir: e.target.value }) })) : null,
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.75'
33
+ export const SERVER_VERSION = '0.8.77'
34
34
  export const inject = ['tools', 'agents', 'webServer']
35
35
 
36
36
  /** 仅供测试:读写状态文件(生产代码不要用)。 */
@@ -825,7 +825,7 @@ async function pollOnce(ctx, entry, baseMs) {
825
825
 
826
826
  // 条目不丢:水位照常全部前移,消息里只铺开前 N 条,其余给编号
827
827
  const limit = Math.max(1, Number(entry.batchLimit) || 5)
828
- const listed = batchFresh(fresh, limit)
828
+ const listed = batchFresh(fresh, limit, entry.priority)
829
829
  const rest = fresh.slice(listed.length)
830
830
  // 暂停/删除可能发生在这一轮轮询期间:以盘上为准
831
831
  const liveEntry = (readState().watchers || {})[entry.id]
@@ -1076,6 +1076,7 @@ export function apply(ctx) {
1076
1076
  filterCounts: w.filterCounts ?? {},
1077
1077
  repoAccess: w.repoAccess ?? null,
1078
1078
  lastReopened: w.lastReopened ?? null,
1079
+ priority: w.priority ?? null,
1079
1080
  lastBatch: w.lastBatch ?? [],
1080
1081
  isolated: w.isolated === true,
1081
1082
  workdir: w.workdir ?? null,
@@ -1212,6 +1213,16 @@ export function apply(ctx) {
1212
1213
  entry.batchLimit = Math.max(1, Math.min(20, Number(body.batchLimit) || entry.batchLimit || 5))
1213
1214
  entry.maxWakesPerHour = Math.max(1, Math.min(60, Number(body.maxWakesPerHour) || entry.maxWakesPerHour || 6))
1214
1215
  if (typeof body.ackLabel === 'string' && body.ackLabel.trim()) entry.ackLabel = body.ackLabel.trim().slice(0, 60)
1216
+ // 优先级开关:客户可以关掉某几类"加权",只按 updated 顺序处理
1217
+ if (body.priority && typeof body.priority === 'object') {
1218
+ entry.priority = {
1219
+ reopened: body.priority.reopened !== false,
1220
+ comments: body.priority.comments !== false,
1221
+ labels: body.priority.labels !== false,
1222
+ // 默认关:没有官方依据支持"无人认领更紧急"
1223
+ unassigned: body.priority.unassigned === true,
1224
+ }
1225
+ }
1215
1226
  // 隔离执行(对标 DeepSeek DSec):每次唤醒开一次性 worktree,改副本不碰主工作区
1216
1227
  entry.observe = body.observe === undefined ? entry.observe === true : body.observe === true
1217
1228
  entry.isolated = body.isolated === undefined ? entry.isolated === true : body.isolated === true
package/lib/watch.js CHANGED
@@ -103,6 +103,7 @@ export function formatWatchText(repo, fresh, options = {}) {
103
103
  (item.assignees ?? []).length > 0 ? `指派: ${item.assignees.map((a) => '@' + a.login).join(' ')}` : null,
104
104
  item.html_url,
105
105
  (stateReasonNote(item) && String(item.state_reason || '') === 'reopened') ? '⚠ ' + stateReasonNote(item) : null,
106
+ assignmentNote(item) || null,
106
107
  item.lastComment
107
108
  ? '最后评论: ' + commentSummaryLine({
108
109
  login: item.lastComment.self ? '' : item.lastComment.login,
@@ -248,21 +249,26 @@ export function pushFiltered(log, record, max = 5) {
248
249
  * 命中我们的标签 5
249
250
  * 其余按 GitHub 的 updated 顺序(稳定排序保持原相对次序)
250
251
  */
251
- export function priorityScore(item) {
252
+ export const DEFAULT_PRIORITY = { reopened: true, comments: true, labels: true, unassigned: false }
253
+
254
+ export function priorityScore(item, options) {
252
255
  if (!item || typeof item !== 'object') return 0
256
+ const on = { ...DEFAULT_PRIORITY, ...(options || {}) }
253
257
  let score = 0
254
- if (String(item.state_reason || '') === 'reopened') score += 100
255
- if (Number(item.comments) > 0) score += 10
256
- if (Array.isArray(item.labels) && item.labels.length > 0) score += 5
258
+ if (on.reopened !== false && String(item.state_reason || '') === 'reopened') score += 100
259
+ if (on.comments !== false && Number(item.comments) > 0) score += 10
260
+ if (on.labels !== false && Array.isArray(item.labels) && item.labels.length > 0) score += 5
261
+ // 默认关闭:这是产品判断而非规则,客户想用再开
262
+ if (on.unassigned === true && assignmentNote(item) !== '') score += 3
257
263
  return score
258
264
  }
259
265
 
260
- export function batchFresh(fresh, limit = 3) {
266
+ export function batchFresh(fresh, limit = 3, priority) {
261
267
  const list = Array.isArray(fresh) ? fresh.slice() : []
262
268
  const n = Math.max(1, Number(limit) || 3)
263
269
  // 稳定排序:分数相同就保持 GitHub 给的 updated 顺序
264
270
  const ranked = list
265
- .map((item, index) => ({ item, index, score: priorityScore(item) }))
271
+ .map((item, index) => ({ item, index, score: priorityScore(item, priority) }))
266
272
  .sort((a, b) => (b.score - a.score) || (a.index - b.index))
267
273
  .map((entry) => entry.item)
268
274
  return ranked.slice(0, n)
@@ -756,3 +762,20 @@ export function stateReasonNote(item) {
756
762
  if (item.state === 'closed' && reason === 'completed') return '关闭原因:已完成'
757
763
  return ''
758
764
  }
765
+
766
+ /**
767
+ * 有没有人认领(assignee)。
768
+ *
769
+ * 依据:issue 对象的 `assignees` 数组;GitHub 的过滤语法里也有现成的 `assignee:` 限定词
770
+ * (我们自己的过滤器 `onlyAssigned` 就基于它)。
771
+ * 出处:https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests
772
+ *
773
+ * 注意:**"无人认领更紧急"是产品判断,不是 GitHub 的规则**(本轮没找到官方依据),
774
+ * 所以只在消息里如实标注,加权默认关闭。
775
+ */
776
+ export function assignmentNote(item) {
777
+ if (!item || typeof item !== 'object') return ''
778
+ const list = Array.isArray(item.assignees) ? item.assignees.filter(Boolean) : []
779
+ if (list.length > 0) return ''
780
+ return '未认领'
781
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.8.75",
3
+ "version": "0.8.77",
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",