dsh-session-superagent 0.9.260 → 0.9.261

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,52 @@
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.9.261] - 2026-11-05 —— 完整解构官方结构树,并落地 Delivery + Outbox
6
+
7
+ ### 完整解构,不只列功能清单
8
+
9
+ 新增 `docs/official-decomp/` 五篇文档(约 1900 行):
10
+
11
+ - `01-structure-tree.md`:完整目录树、分层图、吸收取舍与落地状态;
12
+ - `02-runtime-execution.md`:61 个运行时文件、Trigger→Eval→Ticket→Executor 全链;
13
+ - `03-sources.md`:26 个来源文件、GitHub/Feishu 数据流、读位与幂等;
14
+ - `04-panel-tree.md`:6 Tab、Thread/Ticket 详情、设置分区与全部二三级页面;
15
+ - `05-prompts-skills-operations.md`:提示词、skills、SETUP、迁移、i18n 与测试组织。
16
+
17
+ 所有关键结论锚定官方提交 `8c32a9d` 的文件与行号;不吸收的团队级复杂度也写明理由。
18
+
19
+ ### 吸收 ①:Delivery —— 处理结论可以回写原条目
20
+
21
+ `watch_ack` 新增 `comment: true`:把同一个 `note` 评论到原 issue/PR,而不是只存在本地。
22
+
23
+ ```js
24
+ watch_ack({ number: 7, note: '已修,见 #57', comment: true })
25
+ ```
26
+
27
+ - 默认仍只打标签,不自动发评论;
28
+ - Gitee 通过 `kind: 'issue' | 'pull'` 选择正确端点;
29
+ - `comment:true` 缺 `note` 时,在**任何外部写操作之前**拒绝;
30
+ - 评论失败会明确区分 `phase:'comment'`,不会把「标签已打」误报成完整成功。
31
+
32
+ ### 吸收 ②:Outbox FIFO —— 会话忙时排队,空闲按顺序送
33
+
34
+ 以前忙时只保留水位、下轮重算:不丢事件,但没有真正的队列。
35
+ 现在同一会话的唤醒进入 FIFO:
36
+
37
+ - 忙时入队,回调仍 `ok:false`,**不计次数、不推进水位**;
38
+ - 空闲后按顺序 `followup`,真正发送成功才结算;
39
+ - 相同 `queueKey` 去重,不重复排队;
40
+ - 插件实例隔离,热重载不会误送旧实例消息;
41
+ - 队列在内存中,重启后由未推进的水位重建;
42
+ - 面板行内显示「排队 N」。
43
+
44
+ ### 证据
45
+
46
+ ```
47
+ npm test → 429/429(新增:Delivery 3 + FIFO 3;旧 wake-accounting 也全过)
48
+ test/entry-parity-final.test.mjs → 3/3(上一轮 W9-W11 仍全绿)
49
+ ```
50
+
5
51
  ## [0.9.260] - 2026-11-05 —— T40 入口对等收尾:同一件事,不再两套行为
6
52
 
7
53
  ### 工具新建也会做「添加前体检」
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.9.260-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.261-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
  [![awesome](https://img.shields.io/badge/awesome-dsh--plugin-%E2%9C%93-success.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
146
146
  ## 开发
147
147
 
148
148
  ```sh
149
- npm test # 423 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
149
+ npm test # 429 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
150
150
  ```
151
151
 
152
152
  ### 工具输出:文本给人和 agent,JSON 给程序
@@ -206,7 +206,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
206
206
 
207
207
 
208
208
  ```bash
209
- npm test # 423 项单测(带离线开关,约 1.6 秒)
209
+ npm test # 429 项单测(带离线开关,约 1.6 秒)
210
210
  node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
211
211
  node scripts/preflight.mjs # 41 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
212
212
  node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
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.9.260'
17
+ const CLIENT_VERSION = '0.9.261'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -1335,6 +1335,7 @@ window.__ModuleLoader__.load({
1335
1335
  filterText(watcher.filters) ? h(Tag, null, filterText(watcher.filters)) : null,
1336
1336
  // ack 标签决定这条是否还会被叫醒,不能只在工具参数里出现。
1337
1337
  h(Tag, { tone: 'quiet' }, '回执 ' + (watcher.ackLabel || (watcher.provider === 'gitee' ? '主理鱼-已处理' : '主理鱼:已处理'))),
1338
+ watcher.queuedWakes > 0 ? h(Tag, { tone: 'warning' }, '排队 ' + watcher.queuedWakes) : null,
1338
1339
  backoffText(watcher) ? h(Tag, { tone: 'warning' }, backoffText(watcher)) : null),
1339
1340
  // 三行,各管一件事:① 是谁 ② 节律与最近结果 ③ 目标
1340
1341
  // 原来六段用 ' · ' 串成一行(会话 · 每 60s · 轮询 · 唤醒 · 上次唤醒 · 目标),
package/docs/README.md CHANGED
@@ -11,6 +11,7 @@
11
11
  | [awesome-submission](awesome-submission.md) | 要提交到 awesome-dsh-plugin:现成的 YAML、图标、核对结论 |
12
12
  | [为什么做这个产品](为什么做这个产品.md) | **动任何功能之前先读**:谁在痛、三条不变量(不打断 / 不留手尾 / 不失控)、明确不做什么 |
13
13
  | [对比-官方原型](对比-官方原型.md) | 想知道和官方 `dsh-superagent-prototype` 的功能差距、哪些该抄哪些不该 |
14
+ | [official-decomp/](official-decomp/01-structure-tree.md) | **完整官方结构树**:运行时/事件源/面板/提示词运维逐文件解构,以及已落地与待吸收清单 |
14
15
  | [competitive-analysis](competitive-analysis.md) | 想知道和 Sweep / CodeRabbit 这类工具的差别 |
15
16
  | [deepseek-papers](deepseek-papers.md) | 想知道设计取舍背后的研究依据 |
16
17
  | [真机验证清单](真机验证清单.md) | 重启后三条命令 + 三个动作,5 分钟确认新代码在跑 |
package/lib/gitee.js CHANGED
@@ -163,6 +163,12 @@ export async function addGiteeLabel({ repo, token = '', number, label, fetchImpl
163
163
  return request(`/repos/${repo}/issues/${number}/labels`, { token, method: 'POST', body: { labels: [label] }, fetchImpl })
164
164
  }
165
165
 
166
+ /** 回写处理结论(ack 的可选 Delivery)。PR 与 issue 的端点不同,调用方必须给 kind。 */
167
+ export async function addGiteeComment({ repo, token = '', number, body, kind = 'issue', fetchImpl } = {}) {
168
+ const segment = kind === 'pull' ? 'pulls' : 'issues'
169
+ return request(`/repos/${repo}/${segment}/${number}/comments`, { token, method: 'POST', body: { body: String(body || '') }, fetchImpl })
170
+ }
171
+
166
172
  /** 当前 token 是谁(doctor 用)。 */
167
173
  export async function giteeWhoami({ token = '', fetchImpl } = {}) {
168
174
  return request('/user', { token, fetchImpl })
package/lib/index.js CHANGED
@@ -24,7 +24,7 @@ import { zstdDecompressSync } from 'node:zlib'
24
24
  import { redact } from './redact.js'
25
25
  import { decodeBody, truncateUtf8 } from './body.js'
26
26
  import { quotaDeferText, isOfflineMode } from './gh-format.js'
27
- import { listGiteeItems, fetchGiteeLastComment, addGiteeLabel, ensureGiteeLabel, giteeWhoami, giteeRepo, mapGiteeRepoAccess, DEFAULT_ACK_LABEL_GITEE, giteeLabels, giteeHasLabel, isValidGiteeLabel, suggestGiteeLabel } from './gitee.js'
27
+ import { listGiteeItems, fetchGiteeLastComment, addGiteeLabel, addGiteeComment, ensureGiteeLabel, giteeWhoami, giteeRepo, mapGiteeRepoAccess, DEFAULT_ACK_LABEL_GITEE, giteeLabels, giteeHasLabel, isValidGiteeLabel, suggestGiteeLabel } from './gitee.js'
28
28
  import {
29
29
  effectiveIntervalMs, planWakeSettlement, advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, DEFAULT_PRIORITY, formatWatchText,
30
30
  recordPendingWake, clearPending, pendingRetry,
@@ -46,7 +46,7 @@ import {
46
46
 
47
47
  export const name = 'dsh-session-superagent'
48
48
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
49
- export const SERVER_VERSION = '0.9.260'
49
+ export const SERVER_VERSION = '0.9.261'
50
50
  export const inject = ['tools', 'agents', 'webServer']
51
51
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
52
52
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -111,7 +111,7 @@ const MAX_WATCHERS_TOTAL = 200
111
111
  const CLEANUP_INTERVAL_MS = 10 * 60 * 1000
112
112
 
113
113
  /** 仅供测试:读写状态文件(生产代码不要用)。 */
114
- export const __test = { readState, writeState, hardenSecretsFile, wakeMerged, setAuthStatusCache: (text) => { authStatusCache = { at: text ? Date.now() : 0, text } } }
114
+ export const __test = { readState, writeState, hardenSecretsFile, wakeMerged, flushWakeQueue, wakeQueueCount, clearWakeQueues, setAuthStatusCache: (text) => { authStatusCache = { at: text ? Date.now() : 0, text } } }
115
115
 
116
116
  // 审核 T30:这四个路径以前在**模块加载那一刻**定死 ——
117
117
  // 测试里改 `process.env.DSH_SUPERAGENT_STATE` 之后,已经加载的实例仍然指着老目录,
@@ -757,7 +757,81 @@ function defineTool(options) {
757
757
  const WAKE_WINDOW_MS = Number(process.env.DSH_SUPERAGENT_WAKE_WINDOW_MS) || 3000
758
758
  const wakeBuffers = new Map()
759
759
 
760
- function wakeMerged(ctx, sessionId, text, onSettled) {
760
+ // 会话级 FIFO Outbox:忙时排队,空闲按顺序送。
761
+ // 只存内存;**未送达不推进水位**,所以宿主重启后下一轮会按原事件重建队列,不会丢。
762
+ const WAKE_QUEUE_RETRY_MS = Number(process.env.DSH_SUPERAGENT_WAKE_QUEUE_RETRY_MS) || 5000
763
+ const wakeQueues = new Map()
764
+ const isBusyWakeResult = (result) => /agent busy|会话正忙/i.test(String(result && result.reason || ''))
765
+
766
+ function wakeQueueCount(sessionId, ctx) {
767
+ const queue = wakeQueues.get(sessionId)
768
+ if (ctx && queue && queue.ctx !== ctx) return 0
769
+ return queue ? queue.items.length : 0
770
+ }
771
+
772
+ function scheduleWakeFlush(ctx, sessionId, delay = WAKE_QUEUE_RETRY_MS) {
773
+ const queue = wakeQueues.get(sessionId)
774
+ if (!queue || queue.timer || queue.items.length === 0) return
775
+ queue.timer = setTimeout(() => {
776
+ queue.timer = null
777
+ flushWakeQueue(ctx, sessionId)
778
+ }, delay)
779
+ if (queue.timer && typeof queue.timer.unref === 'function') queue.timer.unref()
780
+ }
781
+
782
+ function flushWakeQueue(ctx, sessionId) {
783
+ const queue = wakeQueues.get(sessionId)
784
+ if (!queue || queue.items.length === 0 || (queue.ctx && queue.ctx !== ctx)) return
785
+ const item = queue.items[0]
786
+ const result = wake(ctx, sessionId, item.text)
787
+ if (isBusyWakeResult(result)) {
788
+ scheduleWakeFlush(ctx, sessionId)
789
+ return
790
+ }
791
+ // 只有离开队首的这一条才结算:成功记已送达;非 busy 失败交给原有错误/重试逻辑。
792
+ queue.items.shift()
793
+ for (const cb of item.settled) {
794
+ try { cb(result) } catch { /* 单个 watcher 的结算失败不能堵住后面的队列 */ }
795
+ }
796
+ if (queue.items.length > 0) scheduleWakeFlush(ctx, sessionId, 0)
797
+ else wakeQueues.delete(sessionId)
798
+ }
799
+
800
+ function enqueueWake(ctx, sessionId, text, settled, key) {
801
+ let queue = wakeQueues.get(sessionId)
802
+ // 热重载后的新实例不能接管旧实例的回调与上下文;未送达水位未推进,旧事件会由新轮询重建。
803
+ if (queue && queue.ctx !== ctx) {
804
+ if (queue.timer) clearTimeout(queue.timer)
805
+ queue = null
806
+ }
807
+ queue = queue || { items: [], timer: null, ctx }
808
+ queue.items.push({ text, settled, key, queuedAt: new Date().toISOString() })
809
+ wakeQueues.set(sessionId, queue)
810
+ scheduleWakeFlush(ctx, sessionId)
811
+ return { ok: false, queued: true, reason: '会话正忙(agent busy),已排队(第 ' + queue.items.length + ' 条)—— 空闲后按顺序送达' }
812
+ }
813
+
814
+ function hasQueuedWake(sessionId, key, ctx) {
815
+ const queue = wakeQueues.get(sessionId)
816
+ return Boolean(key && queue && (!ctx || queue.ctx === ctx) && queue.items.some((item) => item.key === key))
817
+ }
818
+
819
+ function clearWakeQueues(ctx) {
820
+ for (const [sessionId, queue] of wakeQueues) {
821
+ if (ctx && queue.ctx !== ctx) continue
822
+ if (queue.timer) clearTimeout(queue.timer)
823
+ wakeQueues.delete(sessionId)
824
+ }
825
+ }
826
+
827
+ function wakeMerged(ctx, sessionId, text, onSettled, queueKey = '') {
828
+ // 同一事件已在队列里时不重复入队;先尝试 flush,空闲时会立即把旧队列送完。
829
+ flushWakeQueue(ctx, sessionId)
830
+ if (hasQueuedWake(sessionId, queueKey, ctx)) {
831
+ const result = { ok: false, queued: true, reason: '会话正忙(agent busy),该事件已在队列中,不重复入队' }
832
+ if (onSettled) onSettled(result)
833
+ return { ok: true, merged: false, queued: true }
834
+ }
761
835
  const now = Date.now()
762
836
  const buf = wakeBuffers.get(sessionId) || { parts: [], timer: null, openedAt: now, settled: [] }
763
837
  buf.parts.push(text)
@@ -768,7 +842,10 @@ function wakeMerged(ctx, sessionId, text, onSettled) {
768
842
  let result = { ok: false, reason: '合并后没有内容可发(这几条都已被处理过)—— 不用管,下一轮会重新判断' }
769
843
  try {
770
844
  const merged = mergeWakeTexts(buf.parts)
771
- if (merged) result = wake(ctx, sessionId, merged)
845
+ if (merged) {
846
+ result = wake(ctx, sessionId, merged)
847
+ if (isBusyWakeResult(result)) result = enqueueWake(ctx, sessionId, merged, buf.settled, queueKey)
848
+ }
772
849
  } catch (error) {
773
850
  result = { ok: false, reason: String((error && error.message) || error) }
774
851
  }
@@ -1521,6 +1598,7 @@ async function pollWithItems(ctx, entry, baseMs, parsed) {
1521
1598
  // 记账一律放到「真正发送之后」:
1522
1599
  // 之前是入队即记账 —— 会话忙时 decideWake 会拒绝,次数却已经记了、seen 也已经推进,
1523
1600
  // 于是那几条既不会重试(seen 已推进)又白白占掉名额。这是会丢消息的 bug。
1601
+ const wakeQueueKey = entry.id + '|' + fresh.map((item) => String(item.number) + '@' + String(item.updated_at || '')).join(',')
1524
1602
  wakeMerged(ctx, entry.sessionId, wakeText, (result) => {
1525
1603
  // 审核 T20:结算逻辑抽成纯函数 planWakeSettlement()(有单测),这里只负责落副作用。
1526
1604
  const settled = planWakeSettlement(entry, {
@@ -1560,7 +1638,7 @@ async function pollWithItems(ctx, entry, baseMs, parsed) {
1560
1638
  if (settled.lastDeferred) entry.lastDeferred = settled.lastDeferred
1561
1639
  if (settled.bumpBackoff) bumpFailure(entry, baseMs)
1562
1640
  } persistEntry(entry)
1563
- })
1641
+ }, wakeQueueKey)
1564
1642
  }
1565
1643
 
1566
1644
  export function apply(ctx) {
@@ -1781,6 +1859,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
1781
1859
  // 面板要能一眼分出 GitHub / Gitee:否则行内只能靠 id 前缀猜
1782
1860
  provider: w.provider === 'gitee' ? 'gitee' : 'github',
1783
1861
  ackLabel: w.ackLabel || defaultAckLabel(w.provider),
1862
+ // 会话忙时真正排在 FIFO 里的条数;0 表示没有排队,不靠猜 lastDeferred。
1863
+ queuedWakes: wakeQueueCount(w.sessionId, ctx),
1784
1864
  sessionId: w.sessionId,
1785
1865
  intervalSec: w.intervalSec,
1786
1866
  enabled: isEnabled(w),
@@ -2323,6 +2403,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2323
2403
  // 插件卸载/热重载后旧定时器不能继续跑:它们还持有已 dispose 的 ctx
2324
2404
  for (const handle of timers.values()) { try { clearInterval(handle) } catch {} }
2325
2405
  timers.clear()
2406
+ clearWakeQueues(ctx)
2326
2407
  try { clearInterval(sweepHandle) } catch {}
2327
2408
  }
2328
2409
  // 两条路都挂上:ctx.effect 的清理函数在 effect 作用域销毁时一定被调用;
@@ -2383,6 +2464,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2383
2464
  numbers: { type: 'string', description: '逗号分隔的多个编号,如 "12,13,14"(number 与 numbers 至少填一个)' },
2384
2465
  label: { type: 'string', description: 'ack label, default 主理鱼:已处理' },
2385
2466
  note: { type: 'string', description: '可选:一句话记下这条最后怎么处理的(如「已修,见 #57」「不修,上游已修」)。下次这条再被叫醒时会带回来,省得会话重新判一遍。' },
2467
+ comment: { type: 'boolean', description: '把 note 作为评论回写到原 issue/PR(默认 false)。必须同时给 note;这是显式写操作。' },
2468
+ kind: { type: 'string', description: "Gitee 评论回写时的条目类型:'issue'(默认)或 'pull';GitHub 不需要。" },
2386
2469
  format: { type: 'string', description: "'text' (default) or 'json'." },
2387
2470
  },
2388
2471
  async execute(args) {
@@ -2406,6 +2489,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2406
2489
  : watchers.find((w) => w && w.enabled)
2407
2490
  if (!entry) return toolError(args, 'no watcher for that repo — start one with watch_start first')
2408
2491
  const label = String(args.label || entry.ackLabel || defaultAckLabel(entry.provider))
2492
+ const note = typeof args.note === 'string' ? args.note.trim().slice(0, 200) : ''
2493
+ if (args.comment === true && !note) return toolError(args, 'comment:true 需要同时提供 note —— 不会发一条空评论')
2409
2494
  // GitHub 不会因为加标签而自动建标签:不存在时返回 422。先幂等建一次(已存在也返回 422,忽略)。
2410
2495
  // Gitee 没有「建标签」的独立端点(标签必须先存在),所以这边只打标签;
2411
2496
  // 标签不存在时它会 404 —— 让调用方看到真实原因,别假装成功。
@@ -2429,9 +2514,22 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2429
2514
  })()
2430
2515
  : await run('gh', ['api', '-X', 'POST', `repos/${entry.repo}/issues/${number}/labels`, '-f', `labels[]=${label}`], { env: ghEnv() })
2431
2516
  if (res.code !== 0) {
2432
- failed = { number, text: redact([res.stdout, res.stderr].filter(Boolean).join(' ').trim()).slice(0, 200) }
2517
+ failed = { number, text: redact([res.stdout, res.stderr].filter(Boolean).join(' ').trim()).slice(0, 200), phase: 'label' }
2433
2518
  break
2434
2519
  }
2520
+ // Delivery(官方原型可吸收的一部分):处理结论不只留在本地,显式 comment:true 时回写原条目。
2521
+ if (args.comment === true) {
2522
+ const posted = entry.provider === 'gitee'
2523
+ ? await (async () => {
2524
+ const r = await addGiteeComment({ repo: entry.repo, token: String(readSecrets().giteeToken || ''), number, body: note, kind: args.kind === 'pull' ? 'pull' : 'issue' })
2525
+ return { code: r.ok ? 0 : 1, stdout: '', stderr: r.ok ? '' : String(r.status || '') + ' ' + String(r.error || '') }
2526
+ })()
2527
+ : await run('gh', ['api', '-X', 'POST', `repos/${entry.repo}/issues/${number}/comments`, '-f', `body=${note}`], { env: ghEnv() })
2528
+ if (posted.code !== 0) {
2529
+ failed = { number, text: redact([posted.stdout, posted.stderr].filter(Boolean).join(' ').trim()).slice(0, 200), phase: 'comment' }
2530
+ break
2531
+ }
2532
+ }
2435
2533
  results.push(number)
2436
2534
  }
2437
2535
  if (failed) {
@@ -2450,12 +2548,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2450
2548
  if (args && args.format === 'json') {
2451
2549
  return JSON.stringify({
2452
2550
  schemaVersion: 1, ok: false, repo: entry.repo, acked: results,
2453
- failed: { number: failed.number, text: failed.text, kind: why.kind, retryable, advice },
2551
+ failed: { number: failed.number, text: failed.text, kind: why.kind, retryable, advice, phase: failed.phase || 'label' },
2454
2552
  })
2455
2553
  }
2554
+ const phaseNote = failed.phase === 'comment' ? '(标签已打,评论回写失败)' : ''
2456
2555
  return retryable
2457
- ? `[error: #${failed.number} ${advice}(${label})]`
2458
- : `[error: #${failed.number} ${advice}] ${why.hint}`
2556
+ ? `[error: #${failed.number} ${advice}(${label})]${phaseNote}`
2557
+ : `[error: #${failed.number} ${advice}] ${why.hint}${phaseNote}`
2459
2558
  }
2460
2559
  const latest = readState()
2461
2560
  const live = latest.watchers && latest.watchers[entry.id]
@@ -2470,7 +2569,6 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2470
2569
  // 「叫醒之后」的闭环(见 docs/为什么做这个产品.md 诉求 2):
2471
2570
  // 以前只记「叫醒过」,不记「怎么处理的」—— 同一条被重开时会话只能重新判一遍。
2472
2571
  // 有界:只留最近 20 条,超出丢最旧的。
2473
- const note = typeof args.note === 'string' ? args.note.trim().slice(0, 200) : ''
2474
2572
  if (note) {
2475
2573
  const acked = { ...(live.acked || {}) }
2476
2574
  for (const number of results) acked[String(number)] = { at: nowIso, note }
@@ -2481,10 +2579,11 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2481
2579
  }
2482
2580
  if (args && args.format === 'json') {
2483
2581
  // labelNote 是「标签是新建的还是本来就有的」——JSON 分支以前把它丢了,消费方只能猜
2484
- return JSON.stringify({ schemaVersion: 1, ok: true, repo: entry.repo, label, acked: results, at: nowIso, labelNote: labelNote || null })
2582
+ return JSON.stringify({ schemaVersion: 1, ok: true, repo: entry.repo, label, acked: results, at: nowIso, labelNote: labelNote || null, ...(args.comment === true ? { commented: true } : {}) })
2485
2583
  }
2486
2584
  return `acked ${entry.repo} #${results.join(' #')} with label "${label}"` + labelNote
2487
2585
  + (typeof args.note === 'string' && args.note.trim() ? '|记下了:' + args.note.trim().slice(0, 200) : '')
2586
+ + (args.comment === true ? '|已回写评论' : '')
2488
2587
  },
2489
2588
  }))
2490
2589
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.260",
3
+ "version": "0.9.261",
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",