dsh-progress-union 0.8.4 → 0.9.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 +628 -614
- package/LICENSE +21 -21
- package/README.md +395 -385
- package/anchor.js +39 -39
- package/client.js +3828 -3801
- package/cordis.patch.yml +4 -4
- package/docs/slot-models-comparison.md +23 -23
- package/docs/slot-trail-fanout.md +31 -31
- package/docs/spirit-reference.md +38 -38
- package/dsh.plugin.json +1 -1
- package/icon.svg +7 -7
- package/index.js +6165 -6042
- package/package.json +16 -6
- package/test/anchor.test.mjs +139 -139
- package/test/assistant.test.mjs +214 -214
- package/test/client.test.mjs +479 -465
- package/test/download-classify.test.mjs +284 -284
- package/test/e2e.test.mjs +77 -77
- package/test/goal-drive.test.mjs +17 -17
- package/test/harness.mjs +249 -249
- package/test/host.test.mjs +251 -251
- package/test/major-change-notice.test.mjs +174 -174
- package/test/observer.test.mjs +170 -170
- package/test/ops.test.mjs +638 -552
- package/test/parse-progress.test.mjs +78 -78
- package/test/restore-hydrate.test.mjs +185 -185
- package/test/settings.test.mjs +253 -238
- package/test/star-panel.test.mjs +181 -181
- package/test/time.test.mjs +147 -147
- package/test/todo-sync.test.mjs +155 -155
- package/test/tool-gloss.test.mjs +137 -137
package/test/client.test.mjs
CHANGED
|
@@ -1,465 +1,479 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 4 验收:client 契约守卫。
|
|
3
|
-
* 1) 客户端文件不得残留 board 旧命名空间/旧 API 调用(fork 改造回归);
|
|
4
|
-
* 2) 客户端消费的两条路由形状(snapshot / status)由宿主实测钉住。
|
|
5
|
-
*/
|
|
6
|
-
import assert from 'node:assert/strict'
|
|
7
|
-
import fs from 'node:fs'
|
|
8
|
-
import os from 'node:os'
|
|
9
|
-
import path from 'node:path'
|
|
10
|
-
import test from 'node:test'
|
|
11
|
-
|
|
12
|
-
import { fileURLToPath } from 'node:url'
|
|
13
|
-
|
|
14
|
-
process.env.DSH_HOME = fs.mkdtempSync(path.join(os.tmpdir(), 'union-test-'))
|
|
15
|
-
const { SESSION, createHarness, jsonReq, callRoute } = await import('./harness.mjs')
|
|
16
|
-
|
|
17
|
-
// 必须用 fileURLToPath:`new URL(...).pathname` 在 Windows 得到 `/E:/...`(需去前导斜杠),
|
|
18
|
-
// 但 Linux 的 `/` 是根目录,`.replace(/^[/]/,'')` 会把它变成相对路径 → CI 上 ENOENT。
|
|
19
|
-
const clientFile = fileURLToPath(new URL('../client.js', import.meta.url))
|
|
20
|
-
const packageFile = fileURLToPath(new URL('../package.json', import.meta.url))
|
|
21
|
-
|
|
22
|
-
test('client.js 命名空间已切到 union,无 progress-board API 残留', () => {
|
|
23
|
-
const src = fs.readFileSync(clientFile, 'utf8')
|
|
24
|
-
assert.match(src, /id: 'dsh-progress-union'/)
|
|
25
|
-
assert.match(src, /const API = '\/progress-union'/)
|
|
26
|
-
assert.match(src, /STATUS_API = '\/dsh-progress\/status'/)
|
|
27
|
-
assert.doesNotMatch(src, /fetch\(`\/progress-board/, '不得残留旧 API 前缀的直接调用')
|
|
28
|
-
assert.match(src, /useUnionTiming/, '迷你条时间面钩子必须在')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
test('迷你条暂停/继续按钮接线齐全(渲染 + 请求 + 状态门控)', () => {
|
|
32
|
-
const src = fs.readFileSync(clientFile, 'utf8')
|
|
33
|
-
// 渲染:两个按钮都在 dock actions 区
|
|
34
|
-
assert.match(src, /className: 'pb-dock-btn pb-dock-goal pb-dock-goal-pause'/, '暂停按钮必须在')
|
|
35
|
-
assert.match(src, /className: 'pb-dock-btn pb-dock-goal pb-dock-goal-resume'/, '继续按钮必须在')
|
|
36
|
-
// 请求面:走 /progress-union/goal 控制路由
|
|
37
|
-
assert.match(src, /fetch\(`\$\{API\}\/goal`/, '必须调用目标控制路由')
|
|
38
|
-
assert.match(src, /action: 'pause'|onGoalControl\('pause'\)/, '暂停必须接线')
|
|
39
|
-
assert.match(src, /onGoalControl\('resume'\)/, '继续必须接线')
|
|
40
|
-
// 门控:只有目标 active 才给暂停,只有 paused/blocked 才给继续
|
|
41
|
-
assert.match(src, /goalActive = goalPhase === 'active'/, '暂停按钮必须按 phase 门控')
|
|
42
|
-
assert.match(src, /goalStopped = goalPhase === 'paused' \|\| goalPhase === 'blocked'/, '继续按钮必须按 phase 门控')
|
|
43
|
-
// 按钮样式必须真的存在(否则是裸浏览器按钮):背景=主色实心,前景=宿主 on-color 令牌。
|
|
44
|
-
assert.match(src, /\.pb-dock-goal-resume \{[^}]*background: var\(--dsw-alias-brand-primary\)/, '继续按钮需要有主色实心样式')
|
|
45
|
-
assert.match(src, /\.pb-dock-goal-resume \{[^}]*color: var\(--dsw-alias-label-on-color/, '继续按钮前景必须用 on-color 令牌')
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
test('主色实心按钮的前景色不得用 bg-base(玻璃皮肤会把它设成 transparent)', () => {
|
|
49
|
-
const src = fs.readFileSync(clientFile, 'utf8')
|
|
50
|
-
// 事故:maid-atelier 皮肤在 body 上把 --dsw-alias-bg-base 设为 transparent,
|
|
51
|
-
// 拿它当 color 会让「继续」渲染成透明字 → 看着像一块纯色块盖住了按钮。
|
|
52
|
-
assert.doesNotMatch(src, /color:\s*var\(--dsw-alias-bg-base/, '--dsw-alias-bg-base 是页面底色语义,不能当前景色')
|
|
53
|
-
assert.match(src, /\.pb-btn-primary \{[^}]*color: var\(--dsw-alias-label-on-color/, '主按钮前景必须用 on-color 令牌')
|
|
54
|
-
// 选择态底板同样不能用 bg-base(透明后选中段会"消失")。
|
|
55
|
-
assert.doesNotMatch(src, /\[data-on="true"\] \{[^}]*background: var\(--dsw-alias-bg-base/, '分段控件选中态不得用 bg-base 做底板')
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
test('目标文案区分「板目标」与宿主 goal,完成态不报时间面', () => {
|
|
59
|
-
const src = fs.readFileSync(clientFile, 'utf8')
|
|
60
|
-
// 官方 GoalBar 与 /progress-goal 是两套状态机,并排在同一 input dock:文案必须能分辨。
|
|
61
|
-
assert.match(src, /goalPaused: '板目标已暂停'/, 'zh 文案需带「板目标」前缀')
|
|
62
|
-
assert.match(src, /goalPaused: 'Board goal paused'/, 'en 文案需带 Board goal 前缀')
|
|
63
|
-
assert.match(src, /独立于宿主的 \/goal/, '悬停提示需说明与宿主 /goal 的关系')
|
|
64
|
-
assert.match(src, /const allDone = summary\.total > 0 && summary\.done === summary\.total/, '完成态需跳过时间面')
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test('W1: 头部入口注册仍在,且带渲染兜底与分面隔离', () => {
|
|
68
|
-
// 仓内文件是 CRLF:多行断言前先归一,否则 \n 永远匹配不到 \r\n。
|
|
69
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
70
|
-
// 入口本体:槽位 + id + 顺序(5 = 排在宿主自带入口之后、其余插件之前,窄窗口不会被裁掉)
|
|
71
|
-
assert.match(src, /name: 'conversation\.session\.header\.utilities'/, '头部工具区槽位注册必须在')
|
|
72
|
-
assert.match(src, /id: 'progress-union-header'/, '头部入口 id 必须在')
|
|
73
|
-
assert.match(src, /order: 5,/, '头部入口顺序必须提前到 5')
|
|
74
|
-
// 渲染兜底:组件抛错只让这一枚消失,不拖垮整排 utilities
|
|
75
|
-
assert.match(src, /class HeaderEntryBoundary extends React\.Component/, '头部入口必须有错误边界')
|
|
76
|
-
assert.match(src, /getDerivedStateFromError/, '错误边界必须真的降级渲染')
|
|
77
|
-
assert.match(src, /function ProgressHeaderButton\(props\) \{\n return h\(HeaderEntryBoundary/, '导出组件必须包在错误边界里')
|
|
78
|
-
// 分面隔离:任一入口注册失败不得中止 apply(否则图标/迷你条/右栏页签一起消失)
|
|
79
|
-
assert.match(src, /const safeEffect = \(label, register\) =>/, '必须有分面隔离助手')
|
|
80
|
-
const safeCalls = src.match(/^\s+safeEffect\($/gm) || []
|
|
81
|
-
assert.equal(safeCalls.length, 6, '六个入口面(设置×2 / 右栏类型 / 右栏面板 / 头部 / 迷你条)都必须经 safeEffect 注册')
|
|
82
|
-
const bare = src.match(/ctx\.effect\(\s*\n\s*\(\) =>\s*\n\s*ctx\.(slots|sidebarRightTabs)/g) || []
|
|
83
|
-
assert.equal(bare.length, 0, '不得残留裸 ctx.effect 入口注册')
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
test('W2: better-sidebar 页签是独立入口,内容仍是自有板子', () => {
|
|
87
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
88
|
-
assert.match(src, /const BS_TAB_ID = 'dsh-progress-union:board'/, 'better-sidebar 页签 id 必须在')
|
|
89
|
-
assert.doesNotMatch(src, /const BS_TAB_ID = 'progress-union'|const BS_TAB_ID = 'dsh-progress-union'\n/, '页签 id 不得与原生 kind 混用')
|
|
90
|
-
// 服务可能晚于 apply 就绪 → 必须 deferred inject,不能一次性 ctx.get
|
|
91
|
-
assert.match(src, /ctx\.inject\(\['betterSidebar'\], \(bs\) => \{/, '必须用 deferred inject 等待 betterSidebar')
|
|
92
|
-
assert.match(src, /typeof service\.registerTab !== 'function'/, '调用前必须探测 registerTab')
|
|
93
|
-
// 描述符字段齐全
|
|
94
|
-
assert.match(src, /id: BS_TAB_ID,/)
|
|
95
|
-
assert.match(src, /title: \(\) => t\('nav'\),/)
|
|
96
|
-
assert.match(src, /description: \(\) => t\('bsDesc'\),/)
|
|
97
|
-
assert.match(src, /icon: \(size\) => h\(ProgressNavIcon, \{ size: size \|\| 16 \}\)/)
|
|
98
|
-
assert.match(src, /order: 120,/)
|
|
99
|
-
assert.match(src, /single: true,/)
|
|
100
|
-
// 内容是自有板子,且拿到当前会话
|
|
101
|
-
assert.match(src, /h\(ProgressSidePanel, \{/, '页签正文必须是自有 ProgressSidePanel')
|
|
102
|
-
assert.match(src, /sessionId: tabProps && tabProps\.scope \? tabProps\.scope\.sessionId : undefined/)
|
|
103
|
-
// 不传 collapse / toggleFullscreen,避免 better-sidebar 里出现死按钮
|
|
104
|
-
const block = src.slice(src.indexOf("ctx.inject(['betterSidebar']"), src.indexOf("'progress-union: better-sidebar tab'"))
|
|
105
|
-
assert.doesNotMatch(block, /collapse:/, '不得向 better-sidebar 页签传 collapse')
|
|
106
|
-
assert.doesNotMatch(block, /toggleFullscreen:/, '不得向 better-sidebar 页签传 toggleFullscreen')
|
|
107
|
-
// 明确不复用 better-sidebar 的「任务管理」
|
|
108
|
-
assert.doesNotMatch(block, /task.?manage|subagent|后台命令/iu, '不得复用 better-sidebar 的任务管理视图')
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
test('W2: better-sidebar 只是软依赖(未装者必须照常加载)', () => {
|
|
112
|
-
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'))
|
|
113
|
-
const declared = pkg.dsh?.client?.inject ?? []
|
|
114
|
-
assert.equal(declared.includes('dsh-better-sidebar'), false, 'dsh.client.inject 不得声明 dsh-better-sidebar')
|
|
115
|
-
assert.equal('dsh-better-sidebar' in (pkg.dependencies ?? {}), false, 'dependencies 不得声明 dsh-better-sidebar')
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
test('S2: bsDesc 在 zh/en 两个字典里都存在', () => {
|
|
119
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
120
|
-
assert.match(src, /bsDesc: '任务串联的进度板(不是 better-sidebar 的「任务管理」)'/, 'zh 文案必须在')
|
|
121
|
-
assert.match(src, /bsDesc: 'Linked-task progress board \(not better-sidebar task manager\)'/, 'en 文案必须在')
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
test('宿主 snapshot/status 两路由的客户端消费形状', async () => {
|
|
125
|
-
const harness = createHarness()
|
|
126
|
-
await harness.run()
|
|
127
|
-
await callRoute(harness, '/progress-union/active', jsonReq('POST', '/progress-union/active', { sessionId: SESSION, active: true, source: 'command' }))
|
|
128
|
-
await harness.toolMap.get('progress_update').definition.execute(
|
|
129
|
-
{ changes: [{ title: '渲染截图', status: 'doing', current: '渲染第 7/24 张' }, { title: '合成音轨' }] },
|
|
130
|
-
{ agent: harness.agent },
|
|
131
|
-
)
|
|
132
|
-
harness.emit('turn/start', {})
|
|
133
|
-
harness.emit('step/start', {})
|
|
134
|
-
|
|
135
|
-
const snap = (await callRoute(harness, '/progress-union/snapshot', { method: 'GET', url: `/progress-union/snapshot?sessionId=${SESSION}`, headers: {} })).json()
|
|
136
|
-
assert.equal(snap.ok, true)
|
|
137
|
-
assert.equal(snap.enabled, true)
|
|
138
|
-
assert.deepEqual(snap.items.map((i) => i.title), ['渲染截图', '合成音轨'])
|
|
139
|
-
assert.equal(typeof snap.summary.percent, 'number')
|
|
140
|
-
assert.equal('pendingUserChanges' in snap, true)
|
|
141
|
-
|
|
142
|
-
const status = (await callRoute(harness, '/dsh-progress/status', { method: 'GET', url: '/dsh-progress/status', headers: {} })).json()
|
|
143
|
-
assert.equal(status.ok, true)
|
|
144
|
-
assert.equal(status.config.pollMs, 1000)
|
|
145
|
-
assert.ok(status.task, 'status.task 必须存在(迷你条数据源)')
|
|
146
|
-
assert.equal(String(status.task.id), String(SESSION))
|
|
147
|
-
// 板开:阶段直接取板 items,不再走关键词猜测
|
|
148
|
-
assert.deepEqual(status.task.stages, ['渲染截图', '合成音轨'])
|
|
149
|
-
assert.equal(status.task.boardDriven, true)
|
|
150
|
-
assert.equal(status.task.current, 0)
|
|
151
|
-
assert.ok(Array.isArray(status.tasks))
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
test('W3: 板只住在右侧边栏——不再注册主区完整面板', () => {
|
|
155
|
-
// 事故:主区面板没有收拢入口,点进去就回不到会话(进去出不来)。
|
|
156
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
157
|
-
assert.match(src, /const openPanel = \(\) => ctx\.sidebarRight\.openTab\(RIGHT_TAB_KIND\)/, '头部/迷你条入口必须打开右栏页签')
|
|
158
|
-
assert.match(src, /inject: \(\) => \(\{ openPanel, togglePanel \}\)/, '头部入口注入的必须是右栏开关(可见则收起,不可见则打开)')
|
|
159
|
-
assert.doesNotMatch(src, /ctx\.slots\.inject\('main'/, '不得再注册主区完整面板')
|
|
160
|
-
assert.doesNotMatch(src, /layout\.selectPanel/, '不得再切主区面板')
|
|
161
|
-
assert.doesNotMatch(src, /function ProgressPanel\(/, '完整面板组件应已移除')
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
test('W4: 侧栏顶部不再画自带的 全面展开/收起/完整面板 按钮(交给右栏 chrome)', () => {
|
|
165
|
-
// 事故:三个按钮都在,但 toggleFullscreen / collapse 在右栏页签里根本没注入(better-sidebar 里更没处传),
|
|
166
|
-
// 点了没反应才是常态。右栏自身的 chrome 已经有全屏与关闭,不再重复造。
|
|
167
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
168
|
-
assert.doesNotMatch(src, /props\.toggleFullscreen/, '不得再渲染自带的全屏按钮')
|
|
169
|
-
assert.doesNotMatch(src, /props\.collapse/, '不得再渲染自带的收起按钮')
|
|
170
|
-
assert.doesNotMatch(src, /t\('sideFull'\)|t\('sideHalf'\)|t\('sideCollapse'\)/, '三个死按钮的文案不得残留')
|
|
171
|
-
assert.doesNotMatch(src, /toggleFullscreen/, '注入面不得再传全屏切换')
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
test('0.6.2:面板来源行只在 snapshot.restoredFrom 存在时渲染', () => {
|
|
175
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
176
|
-
assert.match(src, /\.pb-side-restore \{/, '来源行样式缺失')
|
|
177
|
-
assert.match(src, /sideRestore: '已从归档 v\{seq\} · rev \{revision\} 恢复,共 \{n\} 项'/, 'zh 文案缺失')
|
|
178
|
-
assert.match(src, /sideRestore: 'Restored from archive/, 'en 文案缺失')
|
|
179
|
-
assert.match(src, /snapshot\?\.restoredFrom\s*\n?\s*\? h\(/, '渲染必须由 restoredFrom 门控')
|
|
180
|
-
assert.match(src, /replace\('\{seq\}', String\(snapshot\.restoredFrom\.seq\)\)/, 'seq 未注入')
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
test('0.6.3:提示卡与用量条间距成体系,且不再出现负 margin', () => {
|
|
184
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
185
|
-
assert.doesNotMatch(src, /margin:\s*-4px/, '不得再有负上边距(用量条顶进提示卡的根因)')
|
|
186
|
-
assert.match(src, /\.pb-llm \{[^}]*margin: 10px 0 12px/, '.pb-llm 下边距必须 12px')
|
|
187
|
-
assert.doesNotMatch(src, /\.pb-llm \{[^}]*margin: 10px 0 0[;}]/, '旧的 0 下边距必须消失')
|
|
188
|
-
assert.match(src, /\.pb-side > \.pb-usage \{[^}]*margin: 0 0 12px/, '用量条上边距必须归零')
|
|
189
|
-
assert.match(src, /\.pb-side > \.pb-llm \+ \.pb-side-error \{ margin-top: 12px; \}/, '同类块相邻补 12px')
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
// ── 0.7.0 rc.2 / Phase 4:下载子进度条(R2 展示面)──────────────────────
|
|
193
|
-
|
|
194
|
-
// 把 client.js 里的 downloadRow 抠出来在 vm 外单跑一次:源码正则只能证明「写了」,
|
|
195
|
-
// 真调用才能证明「关板时返回 null、无真值时不吐假百分比」。
|
|
196
|
-
function loadDownloadRow() {
|
|
197
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
198
|
-
const start = src.indexOf('function downloadRow(dl, t) {')
|
|
199
|
-
assert.ok(start > 0, 'downloadRow 助手必须存在')
|
|
200
|
-
const end = src.indexOf('\n }\n', start)
|
|
201
|
-
assert.ok(end > start, 'downloadRow 函数体必须能定界')
|
|
202
|
-
// eslint-disable-next-line no-new-func
|
|
203
|
-
return new Function('h', 't', `${src.slice(start, end + 6)}\nreturn downloadRow`)(
|
|
204
|
-
(...args) => ({ __el: args }),
|
|
205
|
-
(key) => key,
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
test('rc.2:子条渲染门控——后端不下发 download 时整行不渲染', () => {
|
|
210
|
-
const downloadRow = loadDownloadRow()
|
|
211
|
-
const t = (k) => k
|
|
212
|
-
assert.equal(downloadRow(undefined, t), null, 'snapshot 无 download 键(关板/showSubBar=false/过期)必须不渲染')
|
|
213
|
-
assert.equal(downloadRow(null, t), null)
|
|
214
|
-
assert.equal(downloadRow({ active: false, basis: 'stdout', percent: 50 }, t), null, 'active=false 必须不渲染')
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
test('rc.2:真值档(stdout/board)画实际宽度并显示百分比', () => {
|
|
218
|
-
const downloadRow = loadDownloadRow()
|
|
219
|
-
const row = downloadRow({ active: true, basis: 'stdout', percent: 42.6, kind: 'install', target: 'zod', elapsedSec: 8 }, (k) => k)
|
|
220
|
-
assert.ok(row && row.__el, '子条必须产出元素')
|
|
221
|
-
const [, attrs, ...kids] = row.__el
|
|
222
|
-
assert.equal(attrs.className, 'pb-dock-dl')
|
|
223
|
-
assert.match(String(attrs.title), /dlInstall \u00b7 zod/, '悬停提示需带动作与目标')
|
|
224
|
-
const cls = (n) => (n && n.__el ? String(n.__el[1].className) : '')
|
|
225
|
-
const bar = kids.find((n) => cls(n).indexOf('pb-dock-dl-bar') === 0)
|
|
226
|
-
assert.ok(bar, '必须画进度条')
|
|
227
|
-
assert.equal(cls(bar), 'pb-dock-dl-bar', '有真值时不得加 indeterminate')
|
|
228
|
-
assert.equal(bar.__el[2].__el[1].style.width, '43%', '填充宽度取整百分比')
|
|
229
|
-
const pctNode = kids.find((n) => cls(n) === 'pb-dock-dl-pct')
|
|
230
|
-
assert.ok(pctNode && pctNode.__el[2] === '43%', '百分比文本只在真值档出现')
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
test('rc.2:elapsed 档禁假百分比,走 indeterminate 条纹 + 已用时长;后台加徽标', () => {
|
|
234
|
-
const downloadRow = loadDownloadRow()
|
|
235
|
-
const row = downloadRow({ active: true, basis: 'elapsed', kind: 'clone', target: 'repo.git', elapsedSec: 125, background: true }, (k) => k)
|
|
236
|
-
const [, , ...kids] = row.__el
|
|
237
|
-
const cls = (n) => (n && n.__el ? String(n.__el[1].className) : '')
|
|
238
|
-
const bar = kids.find((n) => cls(n).indexOf('pb-dock-dl-bar') === 0)
|
|
239
|
-
assert.equal(cls(bar), 'pb-dock-dl-bar indeterminate', '无真值必须走条纹档')
|
|
240
|
-
assert.equal(bar.__el[2].__el[1], undefined, '无真值不得写内联 style(假百分比)')
|
|
241
|
-
assert.equal(kids.some((n) => cls(n) === 'pb-dock-dl-pct'), false, '无真值不得出现百分比')
|
|
242
|
-
const badge = kids.find((n) => cls(n) === 'pb-badge-bg')
|
|
243
|
-
assert.ok(badge && badge.__el[2] === 'dlBackground', 'background=true 必须出徽标')
|
|
244
|
-
const time = kids.find((n) => cls(n) === 'pb-dock-dl-time')
|
|
245
|
-
assert.equal(time.__el[2], '2 dlMinUnit', '>=60s 换算成分钟')
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
test('rc.2:子条样式全走宿主令牌,且挂在主条行之后、展开区之前', () => {
|
|
249
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
250
|
-
const cssStart = src.indexOf('.pb-dock-dl {')
|
|
251
|
-
const cssEnd = src.indexOf('.pb-side {')
|
|
252
|
-
assert.ok(cssStart > 0 && cssEnd > cssStart, '子条样式块必须在侧栏样式之前')
|
|
253
|
-
const css = src.slice(cssStart, cssEnd)
|
|
254
|
-
assert.doesNotMatch(css, /#[0-9a-fA-F]{3,6}/, '子条样式不得硬编十六进制色')
|
|
255
|
-
assert.doesNotMatch(css, /rgba?\(/, '子条样式不得硬编 rgb 色(皮肤切换会失配)')
|
|
256
|
-
assert.match(css, /var\(--dsw-alias-brand-primary\)/, '填充色必须用主色令牌')
|
|
257
|
-
assert.match(css, /\.pb-badge-bg \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '后台徽标必须用 warn 令牌')
|
|
258
|
-
assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, '条纹动画必须尊重「减少动效」')
|
|
259
|
-
assert.match(src, /\.pb-dock-dl \{ margin-left: 0; \}/, '760px 段需去掉左缩进')
|
|
260
|
-
assert.match(src, /@media \(max-width: 520px\) \{\s*\.pb-dock-dl \{ display: none; \}/, '极窄屏整行收起')
|
|
261
|
-
const rowIdx = src.indexOf("{ className: 'pb-dock-row' }")
|
|
262
|
-
const dlIdx = src.indexOf('downloadRow(snapshot.download, t),')
|
|
263
|
-
const expIdx = src.indexOf('expanded\n ? h(', dlIdx)
|
|
264
|
-
assert.ok(rowIdx > 0 && rowIdx < dlIdx && dlIdx < expIdx, '子条必须渲染在主条行之后、展开列表之前')
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
test('rc.2:子条文案 zh/en 成对(本仓 client 只有内联 zh/en 两份字典)', () => {
|
|
268
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
269
|
-
const keys = ['dlDownload', 'dlInstall', 'dlClone', 'dlPull', 'dlUnnamed', 'dlBackground', 'dlSecUnit', 'dlMinUnit', 'dlBasisStdout', 'dlBasisBoard', 'dlBasisElapsed']
|
|
270
|
-
for (const k of keys) {
|
|
271
|
-
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
272
|
-
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
// ── rc.3:侧边栏「LLM 操作」小块(R3)────────────────────────────────────
|
|
277
|
-
|
|
278
|
-
/** 把 opsOutcome 从 client.js 里抠出来真跑:它是纯函数(不依赖 React hooks)。 */
|
|
279
|
-
function loadOpsOutcome() {
|
|
280
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
281
|
-
const start = src.indexOf('function opsOutcome(t, json) {')
|
|
282
|
-
assert.ok(start > 0, 'opsOutcome 必须存在')
|
|
283
|
-
const end = src.indexOf('\n }\n', start)
|
|
284
|
-
assert.ok(end > start, 'opsOutcome 函数体必须能定界')
|
|
285
|
-
return new Function('t', `${src.slice(start, end + 6)}\nreturn opsOutcome`)(
|
|
286
|
-
(key) => key,
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
test('rc.3:opsOutcome 把 validate 回执压成文本,ok/warning/error 三档颜色分开', () => {
|
|
291
|
-
const outcome = loadOpsOutcome()
|
|
292
|
-
const t = (key) => key
|
|
293
|
-
const clean = outcome(t, { op: 'validate', validation: { ok: true, count: 3, errors: [], warnings: [] } })
|
|
294
|
-
assert.equal(clean.kind, 'ok')
|
|
295
|
-
assert.equal(clean.text, 'opsValidOk · 3 opsItemsUnit')
|
|
296
|
-
const warned = outcome(t, { op: 'validate', validation: { ok: true, count: 2, errors: [], warnings: ['空板:没有任何任务项'] } })
|
|
297
|
-
assert.equal(warned.kind, 'warn', '可疑但可写 → warn 档,不能当成错误')
|
|
298
|
-
assert.match(warned.text, /空板/)
|
|
299
|
-
const bad = outcome(t, { op: 'validate', validation: { ok: false, count: 4, errors: ['项数 4 超过上限'], warnings: [] } })
|
|
300
|
-
assert.equal(bad.kind, 'bad')
|
|
301
|
-
assert.match(bad.text, /opsValidBad/)
|
|
302
|
-
assert.match(bad.text, /项数 4 超过上限/)
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
test('rc.3:opsOutcome 对 refine/mutate/ask 只回文本,没落地也不冒充成功', () => {
|
|
306
|
-
const outcome = loadOpsOutcome()
|
|
307
|
-
const t = (key) => key
|
|
308
|
-
const refined = outcome(t, { op: 'refine', answer: '已拆成两步', changes: [{ id: 'a' }], warnings: [] })
|
|
309
|
-
assert.equal(refined.kind, 'ok')
|
|
310
|
-
assert.equal(refined.text, '已拆成两步')
|
|
311
|
-
const empty = outcome(t, { op: 'mutate', answer: '', changes: [], warnings: [] })
|
|
312
|
-
assert.equal(empty.text, 'opsNoChanges', '模型没给出可落地改动必须直说')
|
|
313
|
-
const warned = outcome(t, { op: 'ask', answer: '只有 1 项在做', changes: [], warnings: ['同时 doing 2 项'] })
|
|
314
|
-
assert.equal(warned.kind, 'warn')
|
|
315
|
-
assert.equal(warned.text, '只有 1 项在做\n同时 doing 2 项')
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
test('0.7.9:回执拆「思考 / 输出」两区,体检通过不占输出区,打回次数只在 >1 时出现', () => {
|
|
319
|
-
const outcome = loadOpsOutcome()
|
|
320
|
-
const t = (key) => key
|
|
321
|
-
const clean = outcome(t, {
|
|
322
|
-
op: 'refine',
|
|
323
|
-
thinking: '按数据面与展示面拆两步',
|
|
324
|
-
answer: '已拆成两步',
|
|
325
|
-
changes: [{ id: 'a' }],
|
|
326
|
-
warnings: [],
|
|
327
|
-
attempts: 1,
|
|
328
|
-
validation: { ok: true, count: 4, errors: [], warnings: [] },
|
|
329
|
-
})
|
|
330
|
-
assert.equal(clean.think, '按数据面与展示面拆两步', '思考区拿 thinking 字段')
|
|
331
|
-
assert.equal(clean.text, '已拆成两步', '体检顺利通过时不再往输出区插一行「校验通过」')
|
|
332
|
-
assert.equal(clean.kind, 'ok')
|
|
333
|
-
const retried = outcome(t, { op: 'mutate', answer: '重新给一版', changes: [{ id: 'a' }], warnings: [], attempts: 2 })
|
|
334
|
-
assert.match(retried.text, /opsRetried 1/, '被打回过一次必须告知用户重问了几轮')
|
|
335
|
-
const noRetry = outcome(t, { op: 'mutate', answer: '删掉了', changes: [{ id: 'a' }], warnings: [], attempts: 1 })
|
|
336
|
-
assert.equal(noRetry.text.includes('opsRetried'), false, '一次过的不应多一行噪声')
|
|
337
|
-
const warned = outcome(t, { op: 'refine', answer: '已落盘', changes: [{ id: 'a' }], warnings: [], attempts: 1, validation: { ok: true, count: 4, errors: [], warnings: ['同时 doing 2 项'] } })
|
|
338
|
-
assert.equal(warned.kind, 'warn', '体检有提醒 → warn 档,要落进输出区')
|
|
339
|
-
assert.match(warned.text, /同时 doing 2 项/)
|
|
340
|
-
const broken = outcome(t, { op: 'refine', answer: '已落盘', changes: [{ id: 'a' }], warnings: [], attempts: 1, validation: { ok: false, count: 61, errors: ['项数 61 超过上限'], warnings: [] } })
|
|
341
|
-
assert.equal(broken.kind, 'bad')
|
|
342
|
-
assert.match(broken.text, /opsValidBad/)
|
|
343
|
-
assert.match(broken.text, /项数 61 超过上限/)
|
|
344
|
-
const quiet = outcome(t, { op: 'ask', answer: '只有 1 项在做', changes: [], warnings: [] })
|
|
345
|
-
assert.equal(quiet.think, '', '模型没给 thinking 时思考区整块缺席,不留空框')
|
|
346
|
-
})
|
|
347
|
-
|
|
348
|
-
test('0.8.0:降级过才在输出区报一行位次,一次过不占行', () => {
|
|
349
|
-
const outcome = loadOpsOutcome()
|
|
350
|
-
// 真字典里 opsRouteDowngraded 带占位 N(zh「链上第 N 条路由」/ en「chain route N」),
|
|
351
|
-
// 客户端用 replace('N', 位次) 填数;这里用同构文案验证填位本身。
|
|
352
|
-
const t = (key) => (key === 'opsRouteDowngraded' ? 'chain route N' : key)
|
|
353
|
-
const head = outcome(t, { op: 'refine', answer: '已拆两步', changes: [{ id: 'a' }], warnings: [], attempts: 1, routeIndex: 0 })
|
|
354
|
-
assert.equal(head.text.includes('chain route'), false, '链首服务不得多一行噪声')
|
|
355
|
-
const down = outcome(t, { op: 'mutate', answer: '删掉了', changes: [{ id: 'a' }], warnings: [], attempts: 1, routeIndex: 1 })
|
|
356
|
-
assert.equal(down.text, '删掉了\nchain route 2', '链上第二条→报第 2 条')
|
|
357
|
-
assert.equal(down.kind, 'ok', '降级本身不是错误')
|
|
358
|
-
const deep = outcome(t, { op: 'refine', answer: 'x', changes: [{ id: 'a' }], warnings: [], routeIndex: 3 })
|
|
359
|
-
assert.match(deep.text, /chain route 4/)
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
test('rc.3:LLM 操作块只读 providers + POST /ops,不开新标签也不动路由面', () => {
|
|
363
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
364
|
-
assert.match(src, /fetch\(`\$\{API\}\/ops\/providers`/, 'provider 下拉必须拉宿主面,不在客户端写死')
|
|
365
|
-
assert.match(src, /fetch\(`\$\{API\}\/ops`, \{\n\s+method: 'POST'/, '动作统一走 POST /ops')
|
|
366
|
-
assert.match(src, /const OPS_ACTIONS = \[\s*\['refine', 'opsRefine'\],\s*\['mutate', 'opsMutate'\],\s*\['ask', 'opsAsk'\],/, '恰好三个动作——v0.7.9 起「校验」不再上按钮')
|
|
367
|
-
assert.equal(src.includes("['validate', 'opsValidate']"), false, '按钮位不得残留 validate')
|
|
368
|
-
const server = fs.readFileSync(path.join(path.dirname(clientFile), 'index.js'), 'utf8')
|
|
369
|
-
assert.ok(server.includes("if (op === 'validate')"), '服务端 validate 路由必须保留(只是面板不再露出)')
|
|
370
|
-
// 不新开顶级标签:只允许在 ProgressSidePanel 里渲染一次,且不能新增任何 tab/slot 注册
|
|
371
|
-
const panelStart = src.indexOf('function ProgressSidePanel(props) {')
|
|
372
|
-
const panelEnd = src.indexOf("inject: ['slots', 'locale'", panelStart)
|
|
373
|
-
assert.ok(panelStart > 0 && panelEnd > panelStart, 'ProgressSidePanel 边界必须可定界')
|
|
374
|
-
assert.equal((src.match(/h\(LlmOpsBlock, \{/g) || []).length, 1, '操作块只挂一处(侧栏面板内)')
|
|
375
|
-
const usage = src.indexOf('h(LlmOpsBlock, {')
|
|
376
|
-
assert.ok(usage > panelStart && usage < panelEnd, '操作块必须渲染在 ProgressSidePanel 内部')
|
|
377
|
-
assert.ok(src.indexOf('function LlmOpsBlock({') < panelStart, '组件定义在面板之前')
|
|
378
|
-
assert.equal(src.slice(panelStart, panelEnd).includes('sidebarRightTabs'), false, '不得为 LLM 操作新开右侧顶级页签')
|
|
379
|
-
// 落盘回执就地刷板,不额外 GET 一次
|
|
380
|
-
assert.match(src, /if \(body\.applied === true && body\.snapshot\) onApplied\(body\.snapshot\)/)
|
|
381
|
-
assert.match(src, /const applyRemoteSnapshot = useCallback\(/)
|
|
382
|
-
// 宿主侧 ops.enabled=false 时整块收起(不是报错、不是空下拉)
|
|
383
|
-
assert.match(src, /disabled: !!\(body && body\.disabled === true\)/, 'providers 回执里的 disabled 必须透出来')
|
|
384
|
-
const blockStart = src.indexOf('function LlmOpsBlock({')
|
|
385
|
-
const blockEnd = src.indexOf('\n }\n', blockStart)
|
|
386
|
-
const block = src.slice(blockStart, blockEnd)
|
|
387
|
-
assert.match(block, /if \(data\.disabled\) \{[\s\S]*setOff\(true\)/, 'disabled 必须先于 setProviders 短路')
|
|
388
|
-
assert.match(block, /if \(off\) return null/, '开关关掉时整个操作块不渲染')
|
|
389
|
-
assert.ok(block.indexOf('if (off) return null') > block.indexOf('useEffect('), '早退必须在全部 hooks 之后,不破坏 hook 顺序')
|
|
390
|
-
// 两区渲染:思考区只在模型给了 thinking 时出现,不留空框
|
|
391
|
-
assert.match(block, /out && out\.think \? h\(\s*'div',\s*\{ className: 'pb-ops-think' \}/, '思考区挂在输出区之前')
|
|
392
|
-
assert.match(block, /out && out\.text \? h\(\s*'div',\s*\{ className: out\.kind === 'ok' \? 'pb-ops-out'/, '结论区仍按 ok/warn/bad 三档取色')
|
|
393
|
-
// v0.8.0:未钉定路由时块照常渲染,但三个动作锁住 + 给引导文案,不发请求
|
|
394
|
-
assert.match(src, /unconfigured: !!\(body && body\.unconfigured === true\)/, 'providers 回执里的 unconfigured 必须透出来')
|
|
395
|
-
assert.match(block, /const \[unconf, setUnconf\] = useState\(false\)/, '未钉定位必须存下来')
|
|
396
|
-
assert.match(block, /const locked = Boolean\(disabled\) \|\| unconf/, '锁定位 = 开关关掉或未钉定')
|
|
397
|
-
assert.match(block, /if \(busy \|\| !sessionId \|\| unconf\) return/, '未钉定时 run 直接短路,不去撞 403')
|
|
398
|
-
assert.match(block, /unconf\b[\s\S]{0,160}\? h\('div', \{ className: 'pb-ops-note' \}, t\('opsUnconfigured'\)\)/, '未钉定时给引导行而不是空下拉')
|
|
399
|
-
assert.equal(block.includes("h('option', { value: '' }, t('opsProviderNone'))"), false, '白名单下不再有「沿用设置页」这个误导选项')
|
|
400
|
-
assert.match(block, /opsModelLabel\(t, p\)/, 'provider 候选带本地/云端标记')
|
|
401
|
-
assert.match(block, /opsIdOf\(m\), opsModelLabel\(t, m\)/, 'model 候选带本地/云端标记')
|
|
402
|
-
})
|
|
403
|
-
|
|
404
|
-
test('rc.3:操作块样式只用宿主令牌,窄屏降级', () => {
|
|
405
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
406
|
-
const cssStart = src.indexOf('.pb-ops {')
|
|
407
|
-
const cssEnd = src.indexOf('.pb-side-footer {')
|
|
408
|
-
assert.ok(cssStart > 0 && cssEnd > cssStart, '操作块样式必须排在侧栏页脚之前')
|
|
409
|
-
const css = src.slice(cssStart, cssEnd)
|
|
410
|
-
assert.doesNotMatch(css, /#[0-9a-fA-F]{3,6}/, '不得硬编十六进制色')
|
|
411
|
-
assert.doesNotMatch(css, /rgba?\(/, '不得硬编 rgb 色(皮肤切换会失配)')
|
|
412
|
-
assert.match(css, /\.pb-ops-out \{[^}]*var\(--dsw-alias-brand-primary\)/, '结果条左边线用主色令牌')
|
|
413
|
-
assert.match(css, /\.pb-ops-out\.bad \{[^}]*var\(--dsw-alias-state-error-primary\)/, '错误档用 error 令牌')
|
|
414
|
-
assert.match(css, /\.pb-ops-out\.warn \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '可疑档用 warn 令牌')
|
|
415
|
-
assert.match(css, /@media \(max-width: 760px\) \{ \.pb-ops-hint \{ display: none; \} \}/, '窄屏收掉提示文案')
|
|
416
|
-
assert.match(css, /@media \(max-width: 520px\) \{ \.pb-ops-row \{ flex-direction: column; \} \}/, '极窄屏下拉竖排')
|
|
417
|
-
assert.match(css, /\.pb-ops-think \{[^}]*var\(--dsw-alias-border-l2\)/, '思考区左边线用次级边框令牌')
|
|
418
|
-
assert.match(css, /\.pb-ops-think-body \{[^}]*var\(--dsw-alias-label-tertiary\)/, '思考区正文用三级文字令牌(比输出区低一档)')
|
|
419
|
-
assert.match(css, /\.pb-ops-area-label \{[^}]*var\(--dsw-alias-label-tertiary\)/, '分区标题用文字令牌')
|
|
420
|
-
assert.match(css, /\.pb-ops-note \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '未钉定提示行用 warn 令牌,不硬编色')
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
test('rc.3:操作块文案 zh/en 成对(本仓 client 只有内联 zh/en 两份字典)', () => {
|
|
424
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
425
|
-
const keys = ['opsTitle', 'opsHint', 'opsProvider', 'opsModel', 'opsQuestion', 'opsRefine', 'opsMutate', 'opsAsk', 'opsBusy', 'opsNoChanges', 'opsThink', 'opsOut', 'opsRetried', 'opsValidOk', 'opsValidBad', 'opsItemsUnit', 'opsLocalTag', 'opsCloudTag', 'opsRouteDowngraded', 'opsUnconfigured']
|
|
426
|
-
for (const k of keys) {
|
|
427
|
-
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
428
|
-
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
429
|
-
}
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
// v0.8.1:路由链编辑器的文案。这批键全部是面板上看得见的字,漏一语就是
|
|
433
|
-
// 渲染时直接露键名(而不是退成中文)。
|
|
434
|
-
test('v0.8.1:链编辑器文案 zh/en 成对', () => {
|
|
435
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
436
|
-
const keys = ['setOpsChain', 'setOpsChainHint', 'setOpsChainPrimary', 'setOpsChainProvider', 'setOpsChainProviderManual', 'setOpsChainModel', 'setOpsChainModelManual', 'setOpsChainAdd', 'setOpsChainClear', 'setOpsChainMax', 'setOpsChainEffective', 'setOpsChainUnlisted', 'setOpsChainEmpty', 'setOpsChainUp', 'setOpsChainDown', 'setOpsChainRemove']
|
|
437
|
-
for (const k of keys) {
|
|
438
|
-
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
439
|
-
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
440
|
-
}
|
|
441
|
-
// 带占位符的键两边都得含 N,否则 replace('N', …) 会静默不填数
|
|
442
|
-
assert.match(src, /setOpsChainMax: '\u94fe\u6700\u957f N \u884c/, 'zh 链长上限文案要带 N 占位')
|
|
443
|
-
assert.match(src, /setOpsChainMax: 'Chain capped at N rows/, 'en 链长上限文案要带 N 占位')
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
// v0.8.4:registered 模式下 provider/model 未填时的警示行文案。
|
|
447
|
-
// 这一行专门用来防「界面看着像配好了、实际 assistantReady() 为 false」的误读。
|
|
448
|
-
test('v0.8.4:辅助 LLM 未填全的警示行文案 zh/en 成对', () => {
|
|
449
|
-
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
450
|
-
const hits = src.match(/\n\s+setAssistantIncomplete: '[^']+',/g) || []
|
|
451
|
-
assert.equal(hits.length, 2, `setAssistantIncomplete 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
452
|
-
})
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
//
|
|
463
|
-
const
|
|
464
|
-
assert.
|
|
465
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Phase 4 验收:client 契约守卫。
|
|
3
|
+
* 1) 客户端文件不得残留 board 旧命名空间/旧 API 调用(fork 改造回归);
|
|
4
|
+
* 2) 客户端消费的两条路由形状(snapshot / status)由宿主实测钉住。
|
|
5
|
+
*/
|
|
6
|
+
import assert from 'node:assert/strict'
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import os from 'node:os'
|
|
9
|
+
import path from 'node:path'
|
|
10
|
+
import test from 'node:test'
|
|
11
|
+
|
|
12
|
+
import { fileURLToPath } from 'node:url'
|
|
13
|
+
|
|
14
|
+
process.env.DSH_HOME = fs.mkdtempSync(path.join(os.tmpdir(), 'union-test-'))
|
|
15
|
+
const { SESSION, createHarness, jsonReq, callRoute } = await import('./harness.mjs')
|
|
16
|
+
|
|
17
|
+
// 必须用 fileURLToPath:`new URL(...).pathname` 在 Windows 得到 `/E:/...`(需去前导斜杠),
|
|
18
|
+
// 但 Linux 的 `/` 是根目录,`.replace(/^[/]/,'')` 会把它变成相对路径 → CI 上 ENOENT。
|
|
19
|
+
const clientFile = fileURLToPath(new URL('../client.js', import.meta.url))
|
|
20
|
+
const packageFile = fileURLToPath(new URL('../package.json', import.meta.url))
|
|
21
|
+
|
|
22
|
+
test('client.js 命名空间已切到 union,无 progress-board API 残留', () => {
|
|
23
|
+
const src = fs.readFileSync(clientFile, 'utf8')
|
|
24
|
+
assert.match(src, /id: 'dsh-progress-union'/)
|
|
25
|
+
assert.match(src, /const API = '\/progress-union'/)
|
|
26
|
+
assert.match(src, /STATUS_API = '\/dsh-progress\/status'/)
|
|
27
|
+
assert.doesNotMatch(src, /fetch\(`\/progress-board/, '不得残留旧 API 前缀的直接调用')
|
|
28
|
+
assert.match(src, /useUnionTiming/, '迷你条时间面钩子必须在')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('迷你条暂停/继续按钮接线齐全(渲染 + 请求 + 状态门控)', () => {
|
|
32
|
+
const src = fs.readFileSync(clientFile, 'utf8')
|
|
33
|
+
// 渲染:两个按钮都在 dock actions 区
|
|
34
|
+
assert.match(src, /className: 'pb-dock-btn pb-dock-goal pb-dock-goal-pause'/, '暂停按钮必须在')
|
|
35
|
+
assert.match(src, /className: 'pb-dock-btn pb-dock-goal pb-dock-goal-resume'/, '继续按钮必须在')
|
|
36
|
+
// 请求面:走 /progress-union/goal 控制路由
|
|
37
|
+
assert.match(src, /fetch\(`\$\{API\}\/goal`/, '必须调用目标控制路由')
|
|
38
|
+
assert.match(src, /action: 'pause'|onGoalControl\('pause'\)/, '暂停必须接线')
|
|
39
|
+
assert.match(src, /onGoalControl\('resume'\)/, '继续必须接线')
|
|
40
|
+
// 门控:只有目标 active 才给暂停,只有 paused/blocked 才给继续
|
|
41
|
+
assert.match(src, /goalActive = goalPhase === 'active'/, '暂停按钮必须按 phase 门控')
|
|
42
|
+
assert.match(src, /goalStopped = goalPhase === 'paused' \|\| goalPhase === 'blocked'/, '继续按钮必须按 phase 门控')
|
|
43
|
+
// 按钮样式必须真的存在(否则是裸浏览器按钮):背景=主色实心,前景=宿主 on-color 令牌。
|
|
44
|
+
assert.match(src, /\.pb-dock-goal-resume \{[^}]*background: var\(--dsw-alias-brand-primary\)/, '继续按钮需要有主色实心样式')
|
|
45
|
+
assert.match(src, /\.pb-dock-goal-resume \{[^}]*color: var\(--dsw-alias-label-on-color/, '继续按钮前景必须用 on-color 令牌')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('主色实心按钮的前景色不得用 bg-base(玻璃皮肤会把它设成 transparent)', () => {
|
|
49
|
+
const src = fs.readFileSync(clientFile, 'utf8')
|
|
50
|
+
// 事故:maid-atelier 皮肤在 body 上把 --dsw-alias-bg-base 设为 transparent,
|
|
51
|
+
// 拿它当 color 会让「继续」渲染成透明字 → 看着像一块纯色块盖住了按钮。
|
|
52
|
+
assert.doesNotMatch(src, /color:\s*var\(--dsw-alias-bg-base/, '--dsw-alias-bg-base 是页面底色语义,不能当前景色')
|
|
53
|
+
assert.match(src, /\.pb-btn-primary \{[^}]*color: var\(--dsw-alias-label-on-color/, '主按钮前景必须用 on-color 令牌')
|
|
54
|
+
// 选择态底板同样不能用 bg-base(透明后选中段会"消失")。
|
|
55
|
+
assert.doesNotMatch(src, /\[data-on="true"\] \{[^}]*background: var\(--dsw-alias-bg-base/, '分段控件选中态不得用 bg-base 做底板')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('目标文案区分「板目标」与宿主 goal,完成态不报时间面', () => {
|
|
59
|
+
const src = fs.readFileSync(clientFile, 'utf8')
|
|
60
|
+
// 官方 GoalBar 与 /progress-goal 是两套状态机,并排在同一 input dock:文案必须能分辨。
|
|
61
|
+
assert.match(src, /goalPaused: '板目标已暂停'/, 'zh 文案需带「板目标」前缀')
|
|
62
|
+
assert.match(src, /goalPaused: 'Board goal paused'/, 'en 文案需带 Board goal 前缀')
|
|
63
|
+
assert.match(src, /独立于宿主的 \/goal/, '悬停提示需说明与宿主 /goal 的关系')
|
|
64
|
+
assert.match(src, /const allDone = summary\.total > 0 && summary\.done === summary\.total/, '完成态需跳过时间面')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('W1: 头部入口注册仍在,且带渲染兜底与分面隔离', () => {
|
|
68
|
+
// 仓内文件是 CRLF:多行断言前先归一,否则 \n 永远匹配不到 \r\n。
|
|
69
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
70
|
+
// 入口本体:槽位 + id + 顺序(5 = 排在宿主自带入口之后、其余插件之前,窄窗口不会被裁掉)
|
|
71
|
+
assert.match(src, /name: 'conversation\.session\.header\.utilities'/, '头部工具区槽位注册必须在')
|
|
72
|
+
assert.match(src, /id: 'progress-union-header'/, '头部入口 id 必须在')
|
|
73
|
+
assert.match(src, /order: 5,/, '头部入口顺序必须提前到 5')
|
|
74
|
+
// 渲染兜底:组件抛错只让这一枚消失,不拖垮整排 utilities
|
|
75
|
+
assert.match(src, /class HeaderEntryBoundary extends React\.Component/, '头部入口必须有错误边界')
|
|
76
|
+
assert.match(src, /getDerivedStateFromError/, '错误边界必须真的降级渲染')
|
|
77
|
+
assert.match(src, /function ProgressHeaderButton\(props\) \{\n return h\(HeaderEntryBoundary/, '导出组件必须包在错误边界里')
|
|
78
|
+
// 分面隔离:任一入口注册失败不得中止 apply(否则图标/迷你条/右栏页签一起消失)
|
|
79
|
+
assert.match(src, /const safeEffect = \(label, register\) =>/, '必须有分面隔离助手')
|
|
80
|
+
const safeCalls = src.match(/^\s+safeEffect\($/gm) || []
|
|
81
|
+
assert.equal(safeCalls.length, 6, '六个入口面(设置×2 / 右栏类型 / 右栏面板 / 头部 / 迷你条)都必须经 safeEffect 注册')
|
|
82
|
+
const bare = src.match(/ctx\.effect\(\s*\n\s*\(\) =>\s*\n\s*ctx\.(slots|sidebarRightTabs)/g) || []
|
|
83
|
+
assert.equal(bare.length, 0, '不得残留裸 ctx.effect 入口注册')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('W2: better-sidebar 页签是独立入口,内容仍是自有板子', () => {
|
|
87
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
88
|
+
assert.match(src, /const BS_TAB_ID = 'dsh-progress-union:board'/, 'better-sidebar 页签 id 必须在')
|
|
89
|
+
assert.doesNotMatch(src, /const BS_TAB_ID = 'progress-union'|const BS_TAB_ID = 'dsh-progress-union'\n/, '页签 id 不得与原生 kind 混用')
|
|
90
|
+
// 服务可能晚于 apply 就绪 → 必须 deferred inject,不能一次性 ctx.get
|
|
91
|
+
assert.match(src, /ctx\.inject\(\['betterSidebar'\], \(bs\) => \{/, '必须用 deferred inject 等待 betterSidebar')
|
|
92
|
+
assert.match(src, /typeof service\.registerTab !== 'function'/, '调用前必须探测 registerTab')
|
|
93
|
+
// 描述符字段齐全
|
|
94
|
+
assert.match(src, /id: BS_TAB_ID,/)
|
|
95
|
+
assert.match(src, /title: \(\) => t\('nav'\),/)
|
|
96
|
+
assert.match(src, /description: \(\) => t\('bsDesc'\),/)
|
|
97
|
+
assert.match(src, /icon: \(size\) => h\(ProgressNavIcon, \{ size: size \|\| 16 \}\)/)
|
|
98
|
+
assert.match(src, /order: 120,/)
|
|
99
|
+
assert.match(src, /single: true,/)
|
|
100
|
+
// 内容是自有板子,且拿到当前会话
|
|
101
|
+
assert.match(src, /h\(ProgressSidePanel, \{/, '页签正文必须是自有 ProgressSidePanel')
|
|
102
|
+
assert.match(src, /sessionId: tabProps && tabProps\.scope \? tabProps\.scope\.sessionId : undefined/)
|
|
103
|
+
// 不传 collapse / toggleFullscreen,避免 better-sidebar 里出现死按钮
|
|
104
|
+
const block = src.slice(src.indexOf("ctx.inject(['betterSidebar']"), src.indexOf("'progress-union: better-sidebar tab'"))
|
|
105
|
+
assert.doesNotMatch(block, /collapse:/, '不得向 better-sidebar 页签传 collapse')
|
|
106
|
+
assert.doesNotMatch(block, /toggleFullscreen:/, '不得向 better-sidebar 页签传 toggleFullscreen')
|
|
107
|
+
// 明确不复用 better-sidebar 的「任务管理」
|
|
108
|
+
assert.doesNotMatch(block, /task.?manage|subagent|后台命令/iu, '不得复用 better-sidebar 的任务管理视图')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('W2: better-sidebar 只是软依赖(未装者必须照常加载)', () => {
|
|
112
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'))
|
|
113
|
+
const declared = pkg.dsh?.client?.inject ?? []
|
|
114
|
+
assert.equal(declared.includes('dsh-better-sidebar'), false, 'dsh.client.inject 不得声明 dsh-better-sidebar')
|
|
115
|
+
assert.equal('dsh-better-sidebar' in (pkg.dependencies ?? {}), false, 'dependencies 不得声明 dsh-better-sidebar')
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
test('S2: bsDesc 在 zh/en 两个字典里都存在', () => {
|
|
119
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
120
|
+
assert.match(src, /bsDesc: '任务串联的进度板(不是 better-sidebar 的「任务管理」)'/, 'zh 文案必须在')
|
|
121
|
+
assert.match(src, /bsDesc: 'Linked-task progress board \(not better-sidebar task manager\)'/, 'en 文案必须在')
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
test('宿主 snapshot/status 两路由的客户端消费形状', async () => {
|
|
125
|
+
const harness = createHarness()
|
|
126
|
+
await harness.run()
|
|
127
|
+
await callRoute(harness, '/progress-union/active', jsonReq('POST', '/progress-union/active', { sessionId: SESSION, active: true, source: 'command' }))
|
|
128
|
+
await harness.toolMap.get('progress_update').definition.execute(
|
|
129
|
+
{ changes: [{ title: '渲染截图', status: 'doing', current: '渲染第 7/24 张' }, { title: '合成音轨' }] },
|
|
130
|
+
{ agent: harness.agent },
|
|
131
|
+
)
|
|
132
|
+
harness.emit('turn/start', {})
|
|
133
|
+
harness.emit('step/start', {})
|
|
134
|
+
|
|
135
|
+
const snap = (await callRoute(harness, '/progress-union/snapshot', { method: 'GET', url: `/progress-union/snapshot?sessionId=${SESSION}`, headers: {} })).json()
|
|
136
|
+
assert.equal(snap.ok, true)
|
|
137
|
+
assert.equal(snap.enabled, true)
|
|
138
|
+
assert.deepEqual(snap.items.map((i) => i.title), ['渲染截图', '合成音轨'])
|
|
139
|
+
assert.equal(typeof snap.summary.percent, 'number')
|
|
140
|
+
assert.equal('pendingUserChanges' in snap, true)
|
|
141
|
+
|
|
142
|
+
const status = (await callRoute(harness, '/dsh-progress/status', { method: 'GET', url: '/dsh-progress/status', headers: {} })).json()
|
|
143
|
+
assert.equal(status.ok, true)
|
|
144
|
+
assert.equal(status.config.pollMs, 1000)
|
|
145
|
+
assert.ok(status.task, 'status.task 必须存在(迷你条数据源)')
|
|
146
|
+
assert.equal(String(status.task.id), String(SESSION))
|
|
147
|
+
// 板开:阶段直接取板 items,不再走关键词猜测
|
|
148
|
+
assert.deepEqual(status.task.stages, ['渲染截图', '合成音轨'])
|
|
149
|
+
assert.equal(status.task.boardDriven, true)
|
|
150
|
+
assert.equal(status.task.current, 0)
|
|
151
|
+
assert.ok(Array.isArray(status.tasks))
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
test('W3: 板只住在右侧边栏——不再注册主区完整面板', () => {
|
|
155
|
+
// 事故:主区面板没有收拢入口,点进去就回不到会话(进去出不来)。
|
|
156
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
157
|
+
assert.match(src, /const openPanel = \(\) => ctx\.sidebarRight\.openTab\(RIGHT_TAB_KIND\)/, '头部/迷你条入口必须打开右栏页签')
|
|
158
|
+
assert.match(src, /inject: \(\) => \(\{ openPanel, togglePanel \}\)/, '头部入口注入的必须是右栏开关(可见则收起,不可见则打开)')
|
|
159
|
+
assert.doesNotMatch(src, /ctx\.slots\.inject\('main'/, '不得再注册主区完整面板')
|
|
160
|
+
assert.doesNotMatch(src, /layout\.selectPanel/, '不得再切主区面板')
|
|
161
|
+
assert.doesNotMatch(src, /function ProgressPanel\(/, '完整面板组件应已移除')
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
test('W4: 侧栏顶部不再画自带的 全面展开/收起/完整面板 按钮(交给右栏 chrome)', () => {
|
|
165
|
+
// 事故:三个按钮都在,但 toggleFullscreen / collapse 在右栏页签里根本没注入(better-sidebar 里更没处传),
|
|
166
|
+
// 点了没反应才是常态。右栏自身的 chrome 已经有全屏与关闭,不再重复造。
|
|
167
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
168
|
+
assert.doesNotMatch(src, /props\.toggleFullscreen/, '不得再渲染自带的全屏按钮')
|
|
169
|
+
assert.doesNotMatch(src, /props\.collapse/, '不得再渲染自带的收起按钮')
|
|
170
|
+
assert.doesNotMatch(src, /t\('sideFull'\)|t\('sideHalf'\)|t\('sideCollapse'\)/, '三个死按钮的文案不得残留')
|
|
171
|
+
assert.doesNotMatch(src, /toggleFullscreen/, '注入面不得再传全屏切换')
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
test('0.6.2:面板来源行只在 snapshot.restoredFrom 存在时渲染', () => {
|
|
175
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
176
|
+
assert.match(src, /\.pb-side-restore \{/, '来源行样式缺失')
|
|
177
|
+
assert.match(src, /sideRestore: '已从归档 v\{seq\} · rev \{revision\} 恢复,共 \{n\} 项'/, 'zh 文案缺失')
|
|
178
|
+
assert.match(src, /sideRestore: 'Restored from archive/, 'en 文案缺失')
|
|
179
|
+
assert.match(src, /snapshot\?\.restoredFrom\s*\n?\s*\? h\(/, '渲染必须由 restoredFrom 门控')
|
|
180
|
+
assert.match(src, /replace\('\{seq\}', String\(snapshot\.restoredFrom\.seq\)\)/, 'seq 未注入')
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
test('0.6.3:提示卡与用量条间距成体系,且不再出现负 margin', () => {
|
|
184
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
185
|
+
assert.doesNotMatch(src, /margin:\s*-4px/, '不得再有负上边距(用量条顶进提示卡的根因)')
|
|
186
|
+
assert.match(src, /\.pb-llm \{[^}]*margin: 10px 0 12px/, '.pb-llm 下边距必须 12px')
|
|
187
|
+
assert.doesNotMatch(src, /\.pb-llm \{[^}]*margin: 10px 0 0[;}]/, '旧的 0 下边距必须消失')
|
|
188
|
+
assert.match(src, /\.pb-side > \.pb-usage \{[^}]*margin: 0 0 12px/, '用量条上边距必须归零')
|
|
189
|
+
assert.match(src, /\.pb-side > \.pb-llm \+ \.pb-side-error \{ margin-top: 12px; \}/, '同类块相邻补 12px')
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
// ── 0.7.0 rc.2 / Phase 4:下载子进度条(R2 展示面)──────────────────────
|
|
193
|
+
|
|
194
|
+
// 把 client.js 里的 downloadRow 抠出来在 vm 外单跑一次:源码正则只能证明「写了」,
|
|
195
|
+
// 真调用才能证明「关板时返回 null、无真值时不吐假百分比」。
|
|
196
|
+
function loadDownloadRow() {
|
|
197
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
198
|
+
const start = src.indexOf('function downloadRow(dl, t) {')
|
|
199
|
+
assert.ok(start > 0, 'downloadRow 助手必须存在')
|
|
200
|
+
const end = src.indexOf('\n }\n', start)
|
|
201
|
+
assert.ok(end > start, 'downloadRow 函数体必须能定界')
|
|
202
|
+
// eslint-disable-next-line no-new-func
|
|
203
|
+
return new Function('h', 't', `${src.slice(start, end + 6)}\nreturn downloadRow`)(
|
|
204
|
+
(...args) => ({ __el: args }),
|
|
205
|
+
(key) => key,
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
test('rc.2:子条渲染门控——后端不下发 download 时整行不渲染', () => {
|
|
210
|
+
const downloadRow = loadDownloadRow()
|
|
211
|
+
const t = (k) => k
|
|
212
|
+
assert.equal(downloadRow(undefined, t), null, 'snapshot 无 download 键(关板/showSubBar=false/过期)必须不渲染')
|
|
213
|
+
assert.equal(downloadRow(null, t), null)
|
|
214
|
+
assert.equal(downloadRow({ active: false, basis: 'stdout', percent: 50 }, t), null, 'active=false 必须不渲染')
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
test('rc.2:真值档(stdout/board)画实际宽度并显示百分比', () => {
|
|
218
|
+
const downloadRow = loadDownloadRow()
|
|
219
|
+
const row = downloadRow({ active: true, basis: 'stdout', percent: 42.6, kind: 'install', target: 'zod', elapsedSec: 8 }, (k) => k)
|
|
220
|
+
assert.ok(row && row.__el, '子条必须产出元素')
|
|
221
|
+
const [, attrs, ...kids] = row.__el
|
|
222
|
+
assert.equal(attrs.className, 'pb-dock-dl')
|
|
223
|
+
assert.match(String(attrs.title), /dlInstall \u00b7 zod/, '悬停提示需带动作与目标')
|
|
224
|
+
const cls = (n) => (n && n.__el ? String(n.__el[1].className) : '')
|
|
225
|
+
const bar = kids.find((n) => cls(n).indexOf('pb-dock-dl-bar') === 0)
|
|
226
|
+
assert.ok(bar, '必须画进度条')
|
|
227
|
+
assert.equal(cls(bar), 'pb-dock-dl-bar', '有真值时不得加 indeterminate')
|
|
228
|
+
assert.equal(bar.__el[2].__el[1].style.width, '43%', '填充宽度取整百分比')
|
|
229
|
+
const pctNode = kids.find((n) => cls(n) === 'pb-dock-dl-pct')
|
|
230
|
+
assert.ok(pctNode && pctNode.__el[2] === '43%', '百分比文本只在真值档出现')
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
test('rc.2:elapsed 档禁假百分比,走 indeterminate 条纹 + 已用时长;后台加徽标', () => {
|
|
234
|
+
const downloadRow = loadDownloadRow()
|
|
235
|
+
const row = downloadRow({ active: true, basis: 'elapsed', kind: 'clone', target: 'repo.git', elapsedSec: 125, background: true }, (k) => k)
|
|
236
|
+
const [, , ...kids] = row.__el
|
|
237
|
+
const cls = (n) => (n && n.__el ? String(n.__el[1].className) : '')
|
|
238
|
+
const bar = kids.find((n) => cls(n).indexOf('pb-dock-dl-bar') === 0)
|
|
239
|
+
assert.equal(cls(bar), 'pb-dock-dl-bar indeterminate', '无真值必须走条纹档')
|
|
240
|
+
assert.equal(bar.__el[2].__el[1], undefined, '无真值不得写内联 style(假百分比)')
|
|
241
|
+
assert.equal(kids.some((n) => cls(n) === 'pb-dock-dl-pct'), false, '无真值不得出现百分比')
|
|
242
|
+
const badge = kids.find((n) => cls(n) === 'pb-badge-bg')
|
|
243
|
+
assert.ok(badge && badge.__el[2] === 'dlBackground', 'background=true 必须出徽标')
|
|
244
|
+
const time = kids.find((n) => cls(n) === 'pb-dock-dl-time')
|
|
245
|
+
assert.equal(time.__el[2], '2 dlMinUnit', '>=60s 换算成分钟')
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
test('rc.2:子条样式全走宿主令牌,且挂在主条行之后、展开区之前', () => {
|
|
249
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
250
|
+
const cssStart = src.indexOf('.pb-dock-dl {')
|
|
251
|
+
const cssEnd = src.indexOf('.pb-side {')
|
|
252
|
+
assert.ok(cssStart > 0 && cssEnd > cssStart, '子条样式块必须在侧栏样式之前')
|
|
253
|
+
const css = src.slice(cssStart, cssEnd)
|
|
254
|
+
assert.doesNotMatch(css, /#[0-9a-fA-F]{3,6}/, '子条样式不得硬编十六进制色')
|
|
255
|
+
assert.doesNotMatch(css, /rgba?\(/, '子条样式不得硬编 rgb 色(皮肤切换会失配)')
|
|
256
|
+
assert.match(css, /var\(--dsw-alias-brand-primary\)/, '填充色必须用主色令牌')
|
|
257
|
+
assert.match(css, /\.pb-badge-bg \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '后台徽标必须用 warn 令牌')
|
|
258
|
+
assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, '条纹动画必须尊重「减少动效」')
|
|
259
|
+
assert.match(src, /\.pb-dock-dl \{ margin-left: 0; \}/, '760px 段需去掉左缩进')
|
|
260
|
+
assert.match(src, /@media \(max-width: 520px\) \{\s*\.pb-dock-dl \{ display: none; \}/, '极窄屏整行收起')
|
|
261
|
+
const rowIdx = src.indexOf("{ className: 'pb-dock-row' }")
|
|
262
|
+
const dlIdx = src.indexOf('downloadRow(snapshot.download, t),')
|
|
263
|
+
const expIdx = src.indexOf('expanded\n ? h(', dlIdx)
|
|
264
|
+
assert.ok(rowIdx > 0 && rowIdx < dlIdx && dlIdx < expIdx, '子条必须渲染在主条行之后、展开列表之前')
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
test('rc.2:子条文案 zh/en 成对(本仓 client 只有内联 zh/en 两份字典)', () => {
|
|
268
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
269
|
+
const keys = ['dlDownload', 'dlInstall', 'dlClone', 'dlPull', 'dlUnnamed', 'dlBackground', 'dlSecUnit', 'dlMinUnit', 'dlBasisStdout', 'dlBasisBoard', 'dlBasisElapsed']
|
|
270
|
+
for (const k of keys) {
|
|
271
|
+
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
272
|
+
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
// ── rc.3:侧边栏「LLM 操作」小块(R3)────────────────────────────────────
|
|
277
|
+
|
|
278
|
+
/** 把 opsOutcome 从 client.js 里抠出来真跑:它是纯函数(不依赖 React hooks)。 */
|
|
279
|
+
function loadOpsOutcome() {
|
|
280
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
281
|
+
const start = src.indexOf('function opsOutcome(t, json) {')
|
|
282
|
+
assert.ok(start > 0, 'opsOutcome 必须存在')
|
|
283
|
+
const end = src.indexOf('\n }\n', start)
|
|
284
|
+
assert.ok(end > start, 'opsOutcome 函数体必须能定界')
|
|
285
|
+
return new Function('t', `${src.slice(start, end + 6)}\nreturn opsOutcome`)(
|
|
286
|
+
(key) => key,
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
test('rc.3:opsOutcome 把 validate 回执压成文本,ok/warning/error 三档颜色分开', () => {
|
|
291
|
+
const outcome = loadOpsOutcome()
|
|
292
|
+
const t = (key) => key
|
|
293
|
+
const clean = outcome(t, { op: 'validate', validation: { ok: true, count: 3, errors: [], warnings: [] } })
|
|
294
|
+
assert.equal(clean.kind, 'ok')
|
|
295
|
+
assert.equal(clean.text, 'opsValidOk · 3 opsItemsUnit')
|
|
296
|
+
const warned = outcome(t, { op: 'validate', validation: { ok: true, count: 2, errors: [], warnings: ['空板:没有任何任务项'] } })
|
|
297
|
+
assert.equal(warned.kind, 'warn', '可疑但可写 → warn 档,不能当成错误')
|
|
298
|
+
assert.match(warned.text, /空板/)
|
|
299
|
+
const bad = outcome(t, { op: 'validate', validation: { ok: false, count: 4, errors: ['项数 4 超过上限'], warnings: [] } })
|
|
300
|
+
assert.equal(bad.kind, 'bad')
|
|
301
|
+
assert.match(bad.text, /opsValidBad/)
|
|
302
|
+
assert.match(bad.text, /项数 4 超过上限/)
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
test('rc.3:opsOutcome 对 refine/mutate/ask 只回文本,没落地也不冒充成功', () => {
|
|
306
|
+
const outcome = loadOpsOutcome()
|
|
307
|
+
const t = (key) => key
|
|
308
|
+
const refined = outcome(t, { op: 'refine', answer: '已拆成两步', changes: [{ id: 'a' }], warnings: [] })
|
|
309
|
+
assert.equal(refined.kind, 'ok')
|
|
310
|
+
assert.equal(refined.text, '已拆成两步')
|
|
311
|
+
const empty = outcome(t, { op: 'mutate', answer: '', changes: [], warnings: [] })
|
|
312
|
+
assert.equal(empty.text, 'opsNoChanges', '模型没给出可落地改动必须直说')
|
|
313
|
+
const warned = outcome(t, { op: 'ask', answer: '只有 1 项在做', changes: [], warnings: ['同时 doing 2 项'] })
|
|
314
|
+
assert.equal(warned.kind, 'warn')
|
|
315
|
+
assert.equal(warned.text, '只有 1 项在做\n同时 doing 2 项')
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
test('0.7.9:回执拆「思考 / 输出」两区,体检通过不占输出区,打回次数只在 >1 时出现', () => {
|
|
319
|
+
const outcome = loadOpsOutcome()
|
|
320
|
+
const t = (key) => key
|
|
321
|
+
const clean = outcome(t, {
|
|
322
|
+
op: 'refine',
|
|
323
|
+
thinking: '按数据面与展示面拆两步',
|
|
324
|
+
answer: '已拆成两步',
|
|
325
|
+
changes: [{ id: 'a' }],
|
|
326
|
+
warnings: [],
|
|
327
|
+
attempts: 1,
|
|
328
|
+
validation: { ok: true, count: 4, errors: [], warnings: [] },
|
|
329
|
+
})
|
|
330
|
+
assert.equal(clean.think, '按数据面与展示面拆两步', '思考区拿 thinking 字段')
|
|
331
|
+
assert.equal(clean.text, '已拆成两步', '体检顺利通过时不再往输出区插一行「校验通过」')
|
|
332
|
+
assert.equal(clean.kind, 'ok')
|
|
333
|
+
const retried = outcome(t, { op: 'mutate', answer: '重新给一版', changes: [{ id: 'a' }], warnings: [], attempts: 2 })
|
|
334
|
+
assert.match(retried.text, /opsRetried 1/, '被打回过一次必须告知用户重问了几轮')
|
|
335
|
+
const noRetry = outcome(t, { op: 'mutate', answer: '删掉了', changes: [{ id: 'a' }], warnings: [], attempts: 1 })
|
|
336
|
+
assert.equal(noRetry.text.includes('opsRetried'), false, '一次过的不应多一行噪声')
|
|
337
|
+
const warned = outcome(t, { op: 'refine', answer: '已落盘', changes: [{ id: 'a' }], warnings: [], attempts: 1, validation: { ok: true, count: 4, errors: [], warnings: ['同时 doing 2 项'] } })
|
|
338
|
+
assert.equal(warned.kind, 'warn', '体检有提醒 → warn 档,要落进输出区')
|
|
339
|
+
assert.match(warned.text, /同时 doing 2 项/)
|
|
340
|
+
const broken = outcome(t, { op: 'refine', answer: '已落盘', changes: [{ id: 'a' }], warnings: [], attempts: 1, validation: { ok: false, count: 61, errors: ['项数 61 超过上限'], warnings: [] } })
|
|
341
|
+
assert.equal(broken.kind, 'bad')
|
|
342
|
+
assert.match(broken.text, /opsValidBad/)
|
|
343
|
+
assert.match(broken.text, /项数 61 超过上限/)
|
|
344
|
+
const quiet = outcome(t, { op: 'ask', answer: '只有 1 项在做', changes: [], warnings: [] })
|
|
345
|
+
assert.equal(quiet.think, '', '模型没给 thinking 时思考区整块缺席,不留空框')
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
test('0.8.0:降级过才在输出区报一行位次,一次过不占行', () => {
|
|
349
|
+
const outcome = loadOpsOutcome()
|
|
350
|
+
// 真字典里 opsRouteDowngraded 带占位 N(zh「链上第 N 条路由」/ en「chain route N」),
|
|
351
|
+
// 客户端用 replace('N', 位次) 填数;这里用同构文案验证填位本身。
|
|
352
|
+
const t = (key) => (key === 'opsRouteDowngraded' ? 'chain route N' : key)
|
|
353
|
+
const head = outcome(t, { op: 'refine', answer: '已拆两步', changes: [{ id: 'a' }], warnings: [], attempts: 1, routeIndex: 0 })
|
|
354
|
+
assert.equal(head.text.includes('chain route'), false, '链首服务不得多一行噪声')
|
|
355
|
+
const down = outcome(t, { op: 'mutate', answer: '删掉了', changes: [{ id: 'a' }], warnings: [], attempts: 1, routeIndex: 1 })
|
|
356
|
+
assert.equal(down.text, '删掉了\nchain route 2', '链上第二条→报第 2 条')
|
|
357
|
+
assert.equal(down.kind, 'ok', '降级本身不是错误')
|
|
358
|
+
const deep = outcome(t, { op: 'refine', answer: 'x', changes: [{ id: 'a' }], warnings: [], routeIndex: 3 })
|
|
359
|
+
assert.match(deep.text, /chain route 4/)
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
test('rc.3:LLM 操作块只读 providers + POST /ops,不开新标签也不动路由面', () => {
|
|
363
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
364
|
+
assert.match(src, /fetch\(`\$\{API\}\/ops\/providers`/, 'provider 下拉必须拉宿主面,不在客户端写死')
|
|
365
|
+
assert.match(src, /fetch\(`\$\{API\}\/ops`, \{\n\s+method: 'POST'/, '动作统一走 POST /ops')
|
|
366
|
+
assert.match(src, /const OPS_ACTIONS = \[\s*\['refine', 'opsRefine'\],\s*\['mutate', 'opsMutate'\],\s*\['ask', 'opsAsk'\],/, '恰好三个动作——v0.7.9 起「校验」不再上按钮')
|
|
367
|
+
assert.equal(src.includes("['validate', 'opsValidate']"), false, '按钮位不得残留 validate')
|
|
368
|
+
const server = fs.readFileSync(path.join(path.dirname(clientFile), 'index.js'), 'utf8')
|
|
369
|
+
assert.ok(server.includes("if (op === 'validate')"), '服务端 validate 路由必须保留(只是面板不再露出)')
|
|
370
|
+
// 不新开顶级标签:只允许在 ProgressSidePanel 里渲染一次,且不能新增任何 tab/slot 注册
|
|
371
|
+
const panelStart = src.indexOf('function ProgressSidePanel(props) {')
|
|
372
|
+
const panelEnd = src.indexOf("inject: ['slots', 'locale'", panelStart)
|
|
373
|
+
assert.ok(panelStart > 0 && panelEnd > panelStart, 'ProgressSidePanel 边界必须可定界')
|
|
374
|
+
assert.equal((src.match(/h\(LlmOpsBlock, \{/g) || []).length, 1, '操作块只挂一处(侧栏面板内)')
|
|
375
|
+
const usage = src.indexOf('h(LlmOpsBlock, {')
|
|
376
|
+
assert.ok(usage > panelStart && usage < panelEnd, '操作块必须渲染在 ProgressSidePanel 内部')
|
|
377
|
+
assert.ok(src.indexOf('function LlmOpsBlock({') < panelStart, '组件定义在面板之前')
|
|
378
|
+
assert.equal(src.slice(panelStart, panelEnd).includes('sidebarRightTabs'), false, '不得为 LLM 操作新开右侧顶级页签')
|
|
379
|
+
// 落盘回执就地刷板,不额外 GET 一次
|
|
380
|
+
assert.match(src, /if \(body\.applied === true && body\.snapshot\) onApplied\(body\.snapshot\)/)
|
|
381
|
+
assert.match(src, /const applyRemoteSnapshot = useCallback\(/)
|
|
382
|
+
// 宿主侧 ops.enabled=false 时整块收起(不是报错、不是空下拉)
|
|
383
|
+
assert.match(src, /disabled: !!\(body && body\.disabled === true\)/, 'providers 回执里的 disabled 必须透出来')
|
|
384
|
+
const blockStart = src.indexOf('function LlmOpsBlock({')
|
|
385
|
+
const blockEnd = src.indexOf('\n }\n', blockStart)
|
|
386
|
+
const block = src.slice(blockStart, blockEnd)
|
|
387
|
+
assert.match(block, /if \(data\.disabled\) \{[\s\S]*setOff\(true\)/, 'disabled 必须先于 setProviders 短路')
|
|
388
|
+
assert.match(block, /if \(off\) return null/, '开关关掉时整个操作块不渲染')
|
|
389
|
+
assert.ok(block.indexOf('if (off) return null') > block.indexOf('useEffect('), '早退必须在全部 hooks 之后,不破坏 hook 顺序')
|
|
390
|
+
// 两区渲染:思考区只在模型给了 thinking 时出现,不留空框
|
|
391
|
+
assert.match(block, /out && out\.think \? h\(\s*'div',\s*\{ className: 'pb-ops-think' \}/, '思考区挂在输出区之前')
|
|
392
|
+
assert.match(block, /out && out\.text \? h\(\s*'div',\s*\{ className: out\.kind === 'ok' \? 'pb-ops-out'/, '结论区仍按 ok/warn/bad 三档取色')
|
|
393
|
+
// v0.8.0:未钉定路由时块照常渲染,但三个动作锁住 + 给引导文案,不发请求
|
|
394
|
+
assert.match(src, /unconfigured: !!\(body && body\.unconfigured === true\)/, 'providers 回执里的 unconfigured 必须透出来')
|
|
395
|
+
assert.match(block, /const \[unconf, setUnconf\] = useState\(false\)/, '未钉定位必须存下来')
|
|
396
|
+
assert.match(block, /const locked = Boolean\(disabled\) \|\| unconf/, '锁定位 = 开关关掉或未钉定')
|
|
397
|
+
assert.match(block, /if \(busy \|\| !sessionId \|\| unconf\) return/, '未钉定时 run 直接短路,不去撞 403')
|
|
398
|
+
assert.match(block, /unconf\b[\s\S]{0,160}\? h\('div', \{ className: 'pb-ops-note' \}, t\('opsUnconfigured'\)\)/, '未钉定时给引导行而不是空下拉')
|
|
399
|
+
assert.equal(block.includes("h('option', { value: '' }, t('opsProviderNone'))"), false, '白名单下不再有「沿用设置页」这个误导选项')
|
|
400
|
+
assert.match(block, /opsModelLabel\(t, p\)/, 'provider 候选带本地/云端标记')
|
|
401
|
+
assert.match(block, /opsIdOf\(m\), opsModelLabel\(t, m\)/, 'model 候选带本地/云端标记')
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
test('rc.3:操作块样式只用宿主令牌,窄屏降级', () => {
|
|
405
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
406
|
+
const cssStart = src.indexOf('.pb-ops {')
|
|
407
|
+
const cssEnd = src.indexOf('.pb-side-footer {')
|
|
408
|
+
assert.ok(cssStart > 0 && cssEnd > cssStart, '操作块样式必须排在侧栏页脚之前')
|
|
409
|
+
const css = src.slice(cssStart, cssEnd)
|
|
410
|
+
assert.doesNotMatch(css, /#[0-9a-fA-F]{3,6}/, '不得硬编十六进制色')
|
|
411
|
+
assert.doesNotMatch(css, /rgba?\(/, '不得硬编 rgb 色(皮肤切换会失配)')
|
|
412
|
+
assert.match(css, /\.pb-ops-out \{[^}]*var\(--dsw-alias-brand-primary\)/, '结果条左边线用主色令牌')
|
|
413
|
+
assert.match(css, /\.pb-ops-out\.bad \{[^}]*var\(--dsw-alias-state-error-primary\)/, '错误档用 error 令牌')
|
|
414
|
+
assert.match(css, /\.pb-ops-out\.warn \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '可疑档用 warn 令牌')
|
|
415
|
+
assert.match(css, /@media \(max-width: 760px\) \{ \.pb-ops-hint \{ display: none; \} \}/, '窄屏收掉提示文案')
|
|
416
|
+
assert.match(css, /@media \(max-width: 520px\) \{ \.pb-ops-row \{ flex-direction: column; \} \}/, '极窄屏下拉竖排')
|
|
417
|
+
assert.match(css, /\.pb-ops-think \{[^}]*var\(--dsw-alias-border-l2\)/, '思考区左边线用次级边框令牌')
|
|
418
|
+
assert.match(css, /\.pb-ops-think-body \{[^}]*var\(--dsw-alias-label-tertiary\)/, '思考区正文用三级文字令牌(比输出区低一档)')
|
|
419
|
+
assert.match(css, /\.pb-ops-area-label \{[^}]*var\(--dsw-alias-label-tertiary\)/, '分区标题用文字令牌')
|
|
420
|
+
assert.match(css, /\.pb-ops-note \{[^}]*var\(--dsw-alias-state-warn-primary\)/, '未钉定提示行用 warn 令牌,不硬编色')
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
test('rc.3:操作块文案 zh/en 成对(本仓 client 只有内联 zh/en 两份字典)', () => {
|
|
424
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
425
|
+
const keys = ['opsTitle', 'opsHint', 'opsProvider', 'opsModel', 'opsQuestion', 'opsRefine', 'opsMutate', 'opsAsk', 'opsBusy', 'opsNoChanges', 'opsThink', 'opsOut', 'opsRetried', 'opsValidOk', 'opsValidBad', 'opsItemsUnit', 'opsLocalTag', 'opsCloudTag', 'opsRouteDowngraded', 'opsUnconfigured']
|
|
426
|
+
for (const k of keys) {
|
|
427
|
+
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
428
|
+
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
429
|
+
}
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
// v0.8.1:路由链编辑器的文案。这批键全部是面板上看得见的字,漏一语就是
|
|
433
|
+
// 渲染时直接露键名(而不是退成中文)。
|
|
434
|
+
test('v0.8.1:链编辑器文案 zh/en 成对', () => {
|
|
435
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
436
|
+
const keys = ['setOpsChain', 'setOpsChainHint', 'setOpsChainPrimary', 'setOpsChainProvider', 'setOpsChainProviderManual', 'setOpsChainModel', 'setOpsChainModelManual', 'setOpsChainAdd', 'setOpsChainClear', 'setOpsChainMax', 'setOpsChainEffective', 'setOpsChainUnlisted', 'setOpsChainEmpty', 'setOpsChainUp', 'setOpsChainDown', 'setOpsChainRemove']
|
|
437
|
+
for (const k of keys) {
|
|
438
|
+
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
439
|
+
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
440
|
+
}
|
|
441
|
+
// 带占位符的键两边都得含 N,否则 replace('N', …) 会静默不填数
|
|
442
|
+
assert.match(src, /setOpsChainMax: '\u94fe\u6700\u957f N \u884c/, 'zh 链长上限文案要带 N 占位')
|
|
443
|
+
assert.match(src, /setOpsChainMax: 'Chain capped at N rows/, 'en 链长上限文案要带 N 占位')
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
// v0.8.4:registered 模式下 provider/model 未填时的警示行文案。
|
|
447
|
+
// 这一行专门用来防「界面看着像配好了、实际 assistantReady() 为 false」的误读。
|
|
448
|
+
test('v0.8.4:辅助 LLM 未填全的警示行文案 zh/en 成对', () => {
|
|
449
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
450
|
+
const hits = src.match(/\n\s+setAssistantIncomplete: '[^']+',/g) || []
|
|
451
|
+
assert.equal(hits.length, 2, `setAssistantIncomplete 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
// v0.9.0:计划原料的 grounding 回报行。这四个键都是输出区直接可见的字,
|
|
455
|
+
// 漏一语就露键名;而 grounding 不回报的话,用户就无法区分「没喂文档」与「喂了答不上」。
|
|
456
|
+
test('v0.9.0:计划 grounding 回报文案 zh/en 成对', () => {
|
|
457
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
458
|
+
for (const k of ['opsPlanGrounded', 'opsPlanPending', 'opsPlanTruncated', 'opsPlanMiss']) {
|
|
459
|
+
const hits = src.match(new RegExp(`\\n\\s+${k}: '[^']+',`, 'g')) || []
|
|
460
|
+
assert.equal(hits.length, 2, `${k} 必须在 zh/en 各出现一次(实得 ${hits.length})`)
|
|
461
|
+
}
|
|
462
|
+
// grounded 行必须拼进输出区,且两种情态(命中/落空)都要有分支
|
|
463
|
+
assert.match(src, /const grounded = pl && pl\.ok && pl\.slug/, '命中计划时要拼 grounding 行')
|
|
464
|
+
assert.match(src, /pl && pl\.ok === false && pl\.asked/, '点名落空/被关时要走 miss 分支')
|
|
465
|
+
assert.match(src, /retried, downgraded, grounded, notes\.join/, 'grounded 必须进输出区的行列表')
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
test('0.7.0:新增任务 wake 与 R4 落队列互斥,同一次改板队列里只留一条', () => {
|
|
469
|
+
const src = fs.readFileSync(clientFile, 'utf8').replace(/\r\n/g, '\n')
|
|
470
|
+
// 真机偏差:面板加两项后 input-traffic 出现两条同文排队条目——客户端 wake 与
|
|
471
|
+
// 服务端 R4 提醒各发一条。门控必须读服务端 notified 回执。
|
|
472
|
+
assert.match(src, /if \(addedTitles\.length > 0 && body\.notified !== true && body\.noticeMerged !== true\) \{/, 'wake 前必须让位给服务端已落队列(或已合并)的提醒')
|
|
473
|
+
const wakeStart = src.indexOf('props.wakeAgent?.(')
|
|
474
|
+
const gateStart = src.lastIndexOf('if (addedTitles.length > 0', wakeStart)
|
|
475
|
+
assert.ok(gateStart > 0 && wakeStart - gateStart < 400, 'wake 调用必须在 notified 门控块内')
|
|
476
|
+
// 门控只在 mutate 的成功分支里,失败分支(throw)不得触发 wake
|
|
477
|
+
const throwAt = src.lastIndexOf('throw new Error(body?.error', wakeStart)
|
|
478
|
+
assert.ok(throwAt < gateStart, '错误分支必须在门控之前退出,不共享 wake 通道')
|
|
479
|
+
})
|