dsh-progress-union 0.7.0 → 0.7.1
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 +10 -0
- package/README.md +2 -1
- package/client.js +5 -4
- package/dsh.plugin.json +1 -1
- package/index.js +18 -15
- package/package.json +1 -1
- package/test/client.test.mjs +1 -1
- package/test/major-change-notice.test.mjs +9 -0
- package/test/ops.test.mjs +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
本项目的所有值得记录的变更都写在这里。版本号遵循语义化版本。
|
|
4
4
|
|
|
5
|
+
## 0.7.1 (2026-12-04)
|
|
6
|
+
|
|
7
|
+
**fix(ops):同回合被合并的重大变更也要告知客户端,否则面板 wake 与 R4 提醒还是会在队列里各留一条。**
|
|
8
|
+
|
|
9
|
+
- `maybeNotifyMajorChange` 从布尔改为**三态**:`'sent'`(真的投了一条)/ `'merged'`(同 rev 或同回合已被合并)/ `'none'`(非结构性、关板、开关关掉、无活 agent 或派发失败)。`applyChanges` 相应回传 `notified` 与 **`noticeMerged`** 两个布尔,`/action` 与 `/ops` 回执一并带。
|
|
10
|
+
- 客户端 `mutate()` 的 wake 门控补上第二个条件:`if (addedTitles.length > 0 && body.notified !== true && body.noticeMerged !== true)`。真机实测(0.7.0 钉到沙箱宿主 0.2.2-rc.5):同回合第一次改板只出**一条**黄档 `<progress-major-change rev="4">`(去重生效),但第 2/3 次因 `notified=false` 仍会触发客户端 wake,导致队列里多发一条绿档「我在进度板新增了任务」。本版消除该重复。
|
|
11
|
+
- 行为不变式:`notified=false` 且 `noticeMerged=false` 时客户端 wake **逐字退回 0.6.x**(关板 / 关掉 `notifyMajorChanges` / 无活 agent 均靠这一条兜底,不会让提醒静默消失)。
|
|
12
|
+
- **真机实测口径(不属修复,只记录)**:宿主输入流量面板的黄档 DOM 值是 `data-tier="next"`(标签「插话中」,圆点 `rgb(245,158,11)`),且系统注入的 next 档条目只给「收回排队」(**可撤回、不可就地编辑**),而 `later` 绿档条目(`rgb(34,197,94)`)才有完整的上移/下移/编辑/删除/打断并输入按钮——这是宿主渲染规则,插件侧无法改写。另:工具调用长时间执行时 `agent.status` 可不报 `running`,此时按计划的 idle 分支走 `followup`(绿档)。
|
|
13
|
+
- 测试:`test/major-change-notice.test.mjs` 补 `noticeMerged` 四组断言(首次 false / 同回合 true / 开关关掉 false / 关板 false),`test/ops.test.mjs` 补「同回合第 2 次 ops 改板:`notified=false` + `noticeMerged=true` + 队列仍只一条」,`test/client.test.mjs` 改钉新门控。`npm test` 233 pass / 0 fail。
|
|
14
|
+
|
|
5
15
|
## 0.7.0 (2026-12-04)
|
|
6
16
|
|
|
7
17
|
**feat(release):下载感知 + 下载子进度条 + 侧边栏 LLM 任务操作 + 重大变更落输入队列 + 工序可解释,五项能力正式转正(rc.1→rc.3 阶梯收口)。**
|
package/README.md
CHANGED
|
@@ -316,7 +316,8 @@ npm test # node --test test/*.test.mjs(233 用例,纯 mock ctx,无需宿
|
|
|
316
316
|
- 消息 `role:'user'` + `source:{kind:'user', producer:'dsh-progress-union', rev}`,正对 `isHumanSteer` 的采信条件,因此它被当「人插的话」而不是插件自说自话。
|
|
317
317
|
- 正文裹 `<progress-major-change rev="N">`:变更行 + 当前清单 + 「不要按旧顺序推进,动手前先用 progress_update 对账」,模型不必重新拉板。
|
|
318
318
|
- **幂等**:同 `rev` 不重投,同回合只提一次(新回合可再提),所以连续改三次板不会在队列里留三条。`notifyMajorChanges=false`、板未启用、没有活着的 agent 时一条都不发;派发失败只记日志且**不退回 `followup` 补发**,绝不让改板本身失败。
|
|
319
|
-
- **与客户端 wake 不叠加**:面板“新增任务”原本还会另发一条 wake 消息(0.6.x
|
|
319
|
+
- **与客户端 wake 不叠加**:面板“新增任务”原本还会另发一条 wake 消息(0.6.x 就有的客户端通道)。`/action` 回执带两个布尔:`notified`(本回合真的投了一条)与 `noticeMerged`(同 rev / 同回合已被合并),**两者任一为真客户端都不再补发** —— 同一次改板在队列里只留一条带 `<progress-major-change>` 的正式提醒;只有服务端压根没递(关板 / 无活 agent / 开关关掉 / 派发失败)时,wake 行为才逐字退回 0.6.x。
|
|
320
|
+
- **黄档靠宿主渲染**:实测(沙箱宿主 0.2.2-rc.5)steer 进去的条目在 `dsh-input-traffic` 里是 `data-tier="next"`、标签「插话中」,但只给「收回排队」(可撤回、不可就地编辑),可编辑的是 `later` 绿档条目;工具长时间执行时 `agent.status` 可以不报 `running`,那一笔就会走 idle 分支的 `followup`(绿档)。插件只决定投递通道,档位外观归宿主。
|
|
320
321
|
|
|
321
322
|
## 工序可解释(v0.7.0)
|
|
322
323
|
|
package/client.js
CHANGED
|
@@ -24,7 +24,7 @@ window.__ModuleLoader__.load({
|
|
|
24
24
|
var REPO_URL = "https://github.com/drscrewdriver/dsh-progress-union";
|
|
25
25
|
var STAR_NS = "progress-union";
|
|
26
26
|
var STAR_GEN = "v4"; /* ladder:gen */
|
|
27
|
-
var STAR_VERSION = "0.7.
|
|
27
|
+
var STAR_VERSION = "0.7.1"; /* ladder:ver */
|
|
28
28
|
var LANGS = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es", "pt"];
|
|
29
29
|
|
|
30
30
|
// 三代共享:GitHub 单色 mark(octicon 轮廓,fill 随 currentColor)。
|
|
@@ -2742,9 +2742,10 @@ window.__ModuleLoader__.load({
|
|
|
2742
2742
|
.filter((change) => change && !change.id && !change.remove && typeof change.title === 'string')
|
|
2743
2743
|
.map((change) => change.title.trim())
|
|
2744
2744
|
.filter(Boolean)
|
|
2745
|
-
if (addedTitles.length > 0 && body.notified !== true) {
|
|
2746
|
-
// v0.7.0 R4:服务端已经把「板结构变了」递进输入队列(notified=true
|
|
2747
|
-
//
|
|
2745
|
+
if (addedTitles.length > 0 && body.notified !== true && body.noticeMerged !== true) {
|
|
2746
|
+
// v0.7.0 R4:服务端已经把「板结构变了」递进输入队列(notified=true)、或本回合
|
|
2747
|
+
// 已经提醒过被合并(noticeMerged=true)时,客户端不再另发一条 wake
|
|
2748
|
+
// 消息 —— 同一次改板在队列里只留一条。
|
|
2748
2749
|
props.wakeAgent?.(
|
|
2749
2750
|
sessionId,
|
|
2750
2751
|
`我在进度板新增了任务。请按新任务推进。`,
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-progress-union",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"description": "进度结合原型:board 槽位真相源(用户可编辑、diff+ack 增量同步、staleness nudge)× 鲸程时间引擎(step 计数、ETA 三档 board>todo>local>prior、悬浮迷你条),向压缩插件暴露只读三层进度锚点 progressAnchor(board 语义锚 + time 时间锚 + userEdits 未确认改动,service 与 HTTP 双平面),并在 0.6.0 起每回合落一版会话归档(handoff 规则摘要 + 重启注入一次)。",
|
|
6
6
|
"engines": {
|
package/index.js
CHANGED
|
@@ -2209,7 +2209,7 @@ export async function apply(ctx, config) {
|
|
|
2209
2209
|
for (const change of changes) applyOneChange(working, change, origin, at, records, warnings)
|
|
2210
2210
|
|
|
2211
2211
|
let revisionChanged = false
|
|
2212
|
-
let
|
|
2212
|
+
let notice = 'none'
|
|
2213
2213
|
if (records.length > 0) {
|
|
2214
2214
|
working.revision += 1
|
|
2215
2215
|
working.updatedAt = at
|
|
@@ -2255,7 +2255,7 @@ export async function apply(ctx, config) {
|
|
|
2255
2255
|
// v0.7.0 R4:用户或侧边栏 LLM 操作把板改出了结构性变化 → 落输入队列提醒。
|
|
2256
2256
|
// 主模型自己写板(origin='agent')不提醒——它知道刚写了什么;观察者自动同步也不提醒。
|
|
2257
2257
|
if ((origin === 'user' || origin === 'ops') && records.length > 0) {
|
|
2258
|
-
try {
|
|
2258
|
+
try { notice = maybeNotifyMajorChange(sessionId, records, working.revision) } catch (_err) {}
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
// 任何 agent 调用(含 changes=[] 确认)都算一次"模型已看板":重置催办计时;
|
|
@@ -2271,7 +2271,7 @@ export async function apply(ctx, config) {
|
|
|
2271
2271
|
fields: record.fields.map((field) => field.field),
|
|
2272
2272
|
}
|
|
2273
2273
|
})
|
|
2274
|
-
return { snapshot: publicSnapshot(working), changed: changed.filter(Boolean), warnings, notified }
|
|
2274
|
+
return { snapshot: publicSnapshot(working), changed: changed.filter(Boolean), warnings, notified: notice === 'sent', noticeMerged: notice === 'merged' }
|
|
2275
2275
|
}
|
|
2276
2276
|
|
|
2277
2277
|
// ==========================================================================
|
|
@@ -3201,21 +3201,23 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
|
|
|
3201
3201
|
}
|
|
3202
3202
|
|
|
3203
3203
|
/**
|
|
3204
|
-
*
|
|
3204
|
+
* 三态返回(绝不抛):`'sent'` 确实往队列里丢了一条;`'merged'` 本回合/同 rev 已经
|
|
3205
|
+
* 提醒过了,这一次被有意合并(客户端不该再另发 wake);`'none'` 压根没递(非结构性
|
|
3206
|
+
* / 关板 / 无活 agent / 派发失败)——客户端保留 0.6.x 的 wake 行为。
|
|
3205
3207
|
*/
|
|
3206
3208
|
function maybeNotifyMajorChange(sid, records, rev) {
|
|
3207
|
-
if (!cfg.notifyMajorChanges) return
|
|
3208
|
-
if (!isEnabled(sid)) return
|
|
3209
|
+
if (!cfg.notifyMajorChanges) return 'none'
|
|
3210
|
+
if (!isEnabled(sid)) return 'none'
|
|
3209
3211
|
const structural = structuralOf(records)
|
|
3210
|
-
if (structural.length === 0) return
|
|
3212
|
+
if (structural.length === 0) return 'none'
|
|
3211
3213
|
const revN = Math.trunc(Number(rev) || 0)
|
|
3212
|
-
if (revN <= 0) return
|
|
3214
|
+
if (revN <= 0) return 'none'
|
|
3213
3215
|
const o = obsOf(sid)
|
|
3214
3216
|
// 幂等两层:同 rev 不重投(HTTP 重试/重放);同回合只提一次(多改几次合成一条)。
|
|
3215
|
-
if (o.noticeRev === revN) return
|
|
3216
|
-
if (o.noticeTurn === o.turnSeq) return
|
|
3217
|
+
if (o.noticeRev === revN) return 'merged'
|
|
3218
|
+
if (o.noticeTurn === o.turnSeq) return 'merged'
|
|
3217
3219
|
const agent = liveAgentOf(sid)
|
|
3218
|
-
if (!agent) return
|
|
3220
|
+
if (!agent) return 'none'
|
|
3219
3221
|
const message = {
|
|
3220
3222
|
id: `pmc-${revN.toString(36)}-${Math.random().toString(36).slice(2, 8)}`,
|
|
3221
3223
|
role: 'user',
|
|
@@ -3223,7 +3225,7 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
|
|
|
3223
3225
|
source: { kind: 'user', producer: 'dsh-progress-union', rev: revN },
|
|
3224
3226
|
}
|
|
3225
3227
|
const running = agent.status === 'running' && typeof agent.steer === 'function'
|
|
3226
|
-
if (!running && typeof agent.followup !== 'function') return
|
|
3228
|
+
if (!running && typeof agent.followup !== 'function') return 'none'
|
|
3227
3229
|
try {
|
|
3228
3230
|
if (running) agent.steer(message)
|
|
3229
3231
|
else agent.followup(message)
|
|
@@ -3231,13 +3233,13 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
|
|
|
3231
3233
|
try {
|
|
3232
3234
|
ctx.logger?.warn?.(`progress-union: major-change notice failed: ${err instanceof Error ? err.message : String(err)}`)
|
|
3233
3235
|
} catch (_logErr) {}
|
|
3234
|
-
return
|
|
3236
|
+
return 'none'
|
|
3235
3237
|
}
|
|
3236
3238
|
o.noticeRev = revN
|
|
3237
3239
|
o.noticeTurn = o.turnSeq
|
|
3238
3240
|
o.lastNoticeAt = now()
|
|
3239
3241
|
o.noticeTier = running ? 'next-step' : 'next-turn'
|
|
3240
|
-
return
|
|
3242
|
+
return 'sent'
|
|
3241
3243
|
}
|
|
3242
3244
|
|
|
3243
3245
|
// ==========================================================================
|
|
@@ -3449,6 +3451,7 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
|
|
|
3449
3451
|
warnings: (result.warnings || []).concat(post.errors),
|
|
3450
3452
|
answer: answer || `已应用 ${result.changed.length} 条改动`,
|
|
3451
3453
|
notified: result.notified === true,
|
|
3454
|
+
noticeMerged: result.noticeMerged === true,
|
|
3452
3455
|
snapshot: result.snapshot,
|
|
3453
3456
|
}
|
|
3454
3457
|
}
|
|
@@ -5197,7 +5200,7 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
|
|
|
5197
5200
|
expectedRevision: body.expectedRevision,
|
|
5198
5201
|
ackUserRevision: undefined,
|
|
5199
5202
|
})
|
|
5200
|
-
sendJson(res, 200, { ok: true, ...result.snapshot, changed: result.changed, notified: result.notified === true })
|
|
5203
|
+
sendJson(res, 200, { ok: true, ...result.snapshot, changed: result.changed, notified: result.notified === true, noticeMerged: result.noticeMerged === true })
|
|
5201
5204
|
} catch (error) {
|
|
5202
5205
|
const status = error && error.statusCode ? error.statusCode : 400
|
|
5203
5206
|
sendJson(res, status, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-progress-union",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "进度结合原型:dsh-progress-board 槽位真相源 × 鲸程 widget 时间/ETA 引擎;向压缩插件暴露只读三层进度锚点(service + HTTP 双平面);0.6.0 起每回合落一版会话归档(handoff + 重启注入一次)。基于 l3j3y3/dsh-progress-board (MIT) 与 uuhihj/task-progress-bar dsh-progress-widget (MIT)。",
|
|
6
6
|
"license": "MIT",
|
package/test/client.test.mjs
CHANGED
|
@@ -362,7 +362,7 @@ test('0.7.0:新增任务 wake 与 R4 落队列互斥,同一次改板队列
|
|
|
362
362
|
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
363
363
|
// 真机偏差:面板加两项后 input-traffic 出现两条同文排队条目——客户端 wake 与
|
|
364
364
|
// 服务端 R4 提醒各发一条。门控必须读服务端 notified 回执。
|
|
365
|
-
assert.match(src, /if \(addedTitles\.length > 0 && body\.notified !== true\) \{/, 'wake
|
|
365
|
+
assert.match(src, /if \(addedTitles\.length > 0 && body\.notified !== true && body\.noticeMerged !== true\) \{/, 'wake 前必须让位给服务端已落队列(或已合并)的提醒')
|
|
366
366
|
const wakeStart = src.indexOf('props.wakeAgent?.(')
|
|
367
367
|
const gateStart = src.lastIndexOf('if (addedTitles.length > 0', wakeStart)
|
|
368
368
|
assert.ok(gateStart > 0 && wakeStart - gateStart < 400, 'wake 调用必须在 notified 门控块内')
|
|
@@ -43,6 +43,7 @@ test('idle + 用户新增项 → followup 落队列,正文带 <progress-major-
|
|
|
43
43
|
const out = await userEdit(harness, [{ title: '补下载子条' }], before.revision)
|
|
44
44
|
assert.equal(out.ok, true)
|
|
45
45
|
assert.equal(out.notified, true, '/action 必须把服务端是否已落队列告知客户端')
|
|
46
|
+
assert.equal(out.noticeMerged, false, '真的投了一条就不能标 merged')
|
|
46
47
|
assert.equal(harness.followups.length, 1, 'idle 必须走 followup')
|
|
47
48
|
const msg = harness.followups[0]
|
|
48
49
|
assert.equal(msg.role, 'user')
|
|
@@ -86,9 +87,13 @@ test('同回合连续两次结构性改板 → 合并成一条(同 rev 不重
|
|
|
86
87
|
rev = first.revision
|
|
87
88
|
const second = await userEdit(harness, [{ title: 'B' }], rev)
|
|
88
89
|
assert.equal(second.notified, false, '同回合第两次被合并,不得假装已投递')
|
|
90
|
+
// 但必须告知客户端「本回合已经提醒过了」——否则客户端会另发一条 wake,
|
|
91
|
+
// 队列里就同时有 R4 提醒与客户端 wake 两条(真机实测偏差)。
|
|
92
|
+
assert.equal(second.noticeMerged, true, '同回合被合并必须回执 noticeMerged=true')
|
|
89
93
|
rev = second.revision
|
|
90
94
|
const third = await userEdit(harness, [{ title: 'C' }], rev)
|
|
91
95
|
assert.equal(third.notified, false)
|
|
96
|
+
assert.equal(third.noticeMerged, true)
|
|
92
97
|
rev = third.revision
|
|
93
98
|
assert.equal(harness.followups.length, 1, '同一回合只提一次')
|
|
94
99
|
// 已发的那条对应第一次的 rev;后续 rev 不再补投
|
|
@@ -114,6 +119,8 @@ test('notifyMajorChanges:false 一条都不发(逐字退回 0.6.x 行为)',
|
|
|
114
119
|
const before = (await callRoute(harness, '/progress-union/snapshot', { method: 'GET', url: `/progress-union/snapshot?sessionId=${SESSION}`, headers: {} })).json()
|
|
115
120
|
const out = await userEdit(harness, [{ title: '关掉提醒' }], before.revision)
|
|
116
121
|
assert.equal(out.ok, true, '改板本身必须照常成功')
|
|
122
|
+
assert.equal(out.notified, false, '开关关掉时 notified 必为 false,客户端 wake 行为退回 0.6.x')
|
|
123
|
+
assert.equal(out.noticeMerged, false, '开关关掉不算「已合并」')
|
|
117
124
|
assert.equal(harness.followups.length + harness.steers.length, 0)
|
|
118
125
|
})
|
|
119
126
|
|
|
@@ -123,6 +130,8 @@ test('板未启用(关板)时不发;主模型自己写板(origin=agent
|
|
|
123
130
|
const before = (await callRoute(harness, '/progress-union/snapshot', { method: 'GET', url: `/progress-union/snapshot?sessionId=${SESSION}`, headers: {} })).json()
|
|
124
131
|
const out = await userEdit(harness, [{ title: '关板后新增' }], before.revision)
|
|
125
132
|
assert.equal(out.ok, true, '关板后改板本身仍要照常落盘')
|
|
133
|
+
assert.equal(out.notified, false)
|
|
134
|
+
assert.equal(out.noticeMerged, false, '关板是“没递”,不是“已合并”,客户端仍应保留 wake')
|
|
126
135
|
assert.equal(out.items.some((i) => i.title === '关板后新增'), true)
|
|
127
136
|
assert.equal(harness.followups.length + harness.steers.length, 0, '关板不该往队列里丢东西')
|
|
128
137
|
|
package/test/ops.test.mjs
CHANGED
|
@@ -164,6 +164,17 @@ test('op=mutate 能把指令翻成删除(只认板上真 id),并触发 R4
|
|
|
164
164
|
assert.ok(notice, '结构性变更必须落输入队列')
|
|
165
165
|
assert.equal(notice.source.kind, 'user', 'isHumanSteer 只认 kind=user')
|
|
166
166
|
assert.match(notice.content[0].text, /<progress-major-change rev="\d+">/)
|
|
167
|
+
// 回执必须把「已落队列」告知客户端(/ops 与 /action 同一套门控语义)
|
|
168
|
+
assert.equal(r.json.notified, true, 'ops 落盘的结构性变更必须回执 notified=true')
|
|
169
|
+
assert.equal(r.json.noticeMerged, false)
|
|
170
|
+
const before2 = harness.followups.length
|
|
171
|
+
const other = after.items.find((i) => i.title !== '补测试')
|
|
172
|
+
reply = JSON.stringify({ changes: [{ kind: 'remove', id: other.id }] })
|
|
173
|
+
const r2 = await ops(harness, { sessionId: SESSION, op: 'mutate', question: '再删一项' })
|
|
174
|
+
assert.equal(r2.json.applied, true)
|
|
175
|
+
assert.equal(r2.json.notified, false, '同回合第二次 ops 改板被合并,不得假装新投了一条')
|
|
176
|
+
assert.equal(r2.json.noticeMerged, true, '但必须让客户端知道“本回合已经提醒过”,否则它会另发 wake')
|
|
177
|
+
assert.equal(harness.followups.length, before2, '同回合仍只一条队列消息')
|
|
167
178
|
})
|
|
168
179
|
|
|
169
180
|
test('op=mutate/ask 缺 question、未知 op、缺 sessionId 一律 400', async () => {
|