dsh-zcode-startplan 0.4.5 → 1.0.2

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +1963 -405
  2. package/README.md +88 -405
  3. package/bin/cli.mjs +509 -450
  4. package/client.js +2459 -716
  5. package/cordis.patch.yml +4 -2
  6. package/index.js +144 -14
  7. package/lib/adapter.js +476 -422
  8. package/lib/anthropic-body.js +513 -469
  9. package/lib/assemble.js +808 -420
  10. package/lib/auto-claim.js +229 -0
  11. package/lib/captcha/minter.js +61 -7
  12. package/lib/distribution-keys.js +202 -0
  13. package/lib/errors.js +281 -125
  14. package/lib/fallback.js +120 -0
  15. package/lib/local-endpoint.js +367 -352
  16. package/lib/manage-routes.js +1245 -489
  17. package/lib/model-catalog.js +57 -0
  18. package/lib/openai-gateway.js +776 -0
  19. package/lib/plan-client.js +942 -532
  20. package/lib/pool.js +771 -478
  21. package/lib/sse.js +429 -317
  22. package/lib/upstream-api.js +948 -570
  23. package/lib/upstream.js +294 -134
  24. package/lib/version-probe.js +110 -0
  25. package/package.json +84 -80
  26. package/scripts/analyze-grant-intervals.mjs +171 -0
  27. package/scripts/check-compat-rc3.mjs +21 -11
  28. package/scripts/debug-claimable.mjs +130 -0
  29. package/scripts/probe-marketing.mjs +203 -0
  30. package/scripts/restart-dsh.ps1 +119 -76
  31. package/scripts/test-claimed-pending.mjs +152 -0
  32. package/scripts/verify_compat.mjs +75 -64
  33. package/scripts/watch-marketing.mjs +155 -0
  34. package/tests/anthropic-body.test.mjs +305 -0
  35. package/tests/assembler-contract.test.mjs +256 -0
  36. package/tests/auto-claim.test.mjs +318 -0
  37. package/tests/claim-routes.test.mjs +438 -0
  38. package/tests/client-panel.test.mjs +1141 -0
  39. package/tests/distribution-keys.test.mjs +123 -0
  40. package/tests/e2e.test.mjs +388 -0
  41. package/tests/fallback-scrub.test.mjs +105 -0
  42. package/tests/fixtures/quota-200.json +1 -0
  43. package/tests/launch-command.test.mjs +68 -0
  44. package/tests/login-channel.test.mjs +102 -0
  45. package/tests/openai-gateway.test.mjs +454 -0
  46. package/tests/pinned-models.test.mjs +505 -0
  47. package/tests/plan-client.test.mjs +582 -0
  48. package/tests/pool.test.mjs +319 -0
  49. package/tests/quota-blackhole.test.mjs +409 -0
  50. package/tests/restart-script.test.mjs +53 -0
  51. package/tests/routing-quota.test.mjs +251 -0
  52. package/tests/sse.test.mjs +86 -0
  53. package/tests/stream-translator.test.mjs +137 -0
  54. package/tests/support/hanging-stream.mjs +48 -0
  55. package/tests/support/resolve-profile-deps.mjs +52 -0
  56. package/tests/upstream-error-200.test.mjs +164 -0
  57. package/tests/upstream.test.mjs +330 -0
  58. package/tests/version-probe.test.mjs +172 -0
@@ -0,0 +1,438 @@
1
+ /**
2
+ * 赠送额度领取(/claimable + /claim)的**路由级**测试。
3
+ *
4
+ * 上游 HTTP 全部换成假 fetch,但走真实的 `lib/upstream-api.js` 解析与
5
+ * `lib/manage-routes.js` 的路由装配 —— 断言的是「面板点一次按钮,宿主到底
6
+ * 发了什么、怎么处理 captcha」。
7
+ *
8
+ * 三条不可动摇的约定(来自上游实测):
9
+ * 1. captcha **一次性**:每个 plan 必须重新 mint,复用必 3007;
10
+ * 2. `1003` = 已领过,是**幂等成功**,不能报红;
11
+ * 3. captcha 产出失败时**立刻停**,不要连环重试烧设备信誉。
12
+ */
13
+
14
+ import test from 'node:test'
15
+ import assert from 'node:assert/strict'
16
+
17
+ import { makeManageRoutes } from '../lib/manage-routes.js'
18
+
19
+ /** 极简 req/res 桩:够 readJsonBody / writeJson 用。 */
20
+ function makeReqRes({ method = 'GET', url = '/', body } = {}) {
21
+ const chunks = body === undefined ? [] : [Buffer.from(JSON.stringify(body))]
22
+ const req = {
23
+ method,
24
+ url,
25
+ socket: { remoteAddress: '127.0.0.1' },
26
+ headers: { host: '127.0.0.1:58962', 'content-type': 'application/json' },
27
+ on(event, handler) {
28
+ if (event === 'data') chunks.forEach((chunk) => handler(chunk))
29
+ if (event === 'end') handler()
30
+ return req
31
+ },
32
+ destroy() {},
33
+ }
34
+ let captured
35
+ let status = 200
36
+ const res = {
37
+ writableEnded: false,
38
+ destroyed: false,
39
+ writeHead(code) {
40
+ status = code
41
+ },
42
+ end(text) {
43
+ res.writableEnded = true
44
+ captured = text
45
+ },
46
+ get body() {
47
+ return captured === undefined ? undefined : JSON.parse(captured)
48
+ },
49
+ get status() {
50
+ return status
51
+ },
52
+ }
53
+ return { req, res }
54
+ }
55
+
56
+ /** 账号池桩:一条账号、带凭据。 */
57
+ const pool = {
58
+ list: ({ withCredentials } = {}) => [
59
+ {
60
+ id: 'acc-1',
61
+ nickname: 'TARGET_ACCOUNT',
62
+ enabled: true,
63
+ user_id: 'user-1',
64
+ added_at: 1,
65
+ model_rate_limits: {},
66
+ last_error: null,
67
+ ...(withCredentials === true
68
+ ? { credential: { zcode_jwt: 'ZCODE_JWT', device_mid: 'DEVICE_MID', app_version: '3.14.3' } }
69
+ : {}),
70
+ },
71
+ ],
72
+ get: (id) => undefined,
73
+ }
74
+
75
+ /** 找到某条路由并调用。 */
76
+ async function call(routes, path, options) {
77
+ const route = routes.find((item) => item.path === path)
78
+ assert.ok(route !== undefined, `没有注册 ${path}`)
79
+ const { req, res } = makeReqRes(options)
80
+ await route.handler(req, res)
81
+ return res
82
+ }
83
+
84
+ /** 可领取的活动(priority 降序由 fetchClaimablePlans 排)。 */
85
+ const CLAIMABLE_PLANS = [
86
+ { plan_id: 'plan-low', name: 'LOW', priority: 10 },
87
+ { plan_id: 'plan-high', name: 'HIGH', priority: 90 },
88
+ ]
89
+
90
+ /** 官方形状的 marketing/touch 投放(claim 按钮携带 plan_id)。 */
91
+ const marketingTouchBody = {
92
+ code: 0,
93
+ data: {
94
+ server_time: 1790000000,
95
+ language: 'zh-CN',
96
+ deliveries: [
97
+ {
98
+ campaign_id: 'camp-low',
99
+ priority: 10,
100
+ resource_position: 'popup',
101
+ popup: { buttons: [{ text: { format: 'plaintext', content: 'LOW' }, action: { type: 'claim_zcode_plan', args: { plan_id: 'plan-low' } } }] },
102
+ },
103
+ {
104
+ campaign_id: 'camp-high',
105
+ priority: 90,
106
+ resource_position: 'banner',
107
+ banner: { buttons: [{ text: { format: 'plaintext', content: 'HIGH' }, action: { type: 'claim_zcode_plan', args: { plan_id: 'plan-high' } } }] },
108
+ },
109
+ ],
110
+ },
111
+ }
112
+
113
+ /** 假上游:按 URL 分发,并记录 captcha 头,供断言「每个 plan 都重新 mint」。 */
114
+ function makeUpstream({ claimCodes = [0, 0], captchaFails = false } = {}) {
115
+ const calls = { claim: [], captchaHeaders: [], touch: 0, report: 0, confirms: [] }
116
+ let claimIndex = 0
117
+ const fetchImpl = async (url, init = {}) => {
118
+ const target = String(url)
119
+ if (target.includes('/event/report')) {
120
+ calls.report += 1
121
+ return new Response(JSON.stringify({ code: 0 }), { status: 200, headers: { 'content-type': 'application/json' } })
122
+ }
123
+ if (target.includes('/marketing/touch/action')) {
124
+ calls.confirms.push(JSON.parse(init.body).campaign_id)
125
+ return new Response(JSON.stringify({ code: 0 }), { status: 200, headers: { 'content-type': 'application/json' } })
126
+ }
127
+ if (target.includes('/marketing/touch')) {
128
+ calls.touch += 1
129
+ return new Response(JSON.stringify(marketingTouchBody), {
130
+ status: 200,
131
+ headers: { 'content-type': 'application/json' },
132
+ })
133
+ }
134
+ if (target.includes('/billing/claim')) {
135
+ const payload = JSON.parse(init.body)
136
+ calls.claim.push(payload.plan_id)
137
+ calls.captchaHeaders.push(init.headers['x-aliyun-captcha-verify-param'])
138
+ const code = claimCodes[claimIndex++] ?? 0
139
+ return new Response(JSON.stringify({ code, msg: code === 0 ? '' : 'x' }), {
140
+ status: 200,
141
+ headers: { 'content-type': 'application/json' },
142
+ })
143
+ }
144
+ throw new Error(`未预期的上游请求:${target}`)
145
+ }
146
+ /** captcha minter 桩:每次给一个新 param(一次性)。 */
147
+ let seq = 0
148
+ const client = {
149
+ async mintCaptcha() {
150
+ if (captchaFails) throw new Error('连不上宿主调试端口')
151
+ seq += 1
152
+ return { param: `param-${seq}`, region: 'cn' }
153
+ },
154
+ }
155
+ return { fetchImpl, client, calls }
156
+ }
157
+
158
+ /**
159
+ * ⚠ `lib/upstream-api.js` 用**模块级** `globalThis.fetch` 默认值。
160
+ * 这里临时替换全局 fetch(测试单进程串行跑,用完立刻还原)。
161
+ */
162
+ async function withGlobalFetch(fetchImpl, fn) {
163
+ const original = globalThis.fetch
164
+ globalThis.fetch = fetchImpl
165
+ try {
166
+ return await fn()
167
+ } finally {
168
+ globalThis.fetch = original
169
+ }
170
+ }
171
+
172
+ function buildRoutes(client) {
173
+ return makeManageRoutes({
174
+ pool,
175
+ client,
176
+ fetchBalance: async () => undefined,
177
+ settings: {},
178
+ log: () => {},
179
+ })
180
+ }
181
+
182
+ test('/claimable: 走官方 marketing/touch 发现端点,返回投放按钮里的 plan 列表', async () => {
183
+ const { fetchImpl, client, calls } = makeUpstream()
184
+ const routes = buildRoutes(client)
185
+ const res = await withGlobalFetch(fetchImpl, () => call(routes, '/api/zcode-start-plan/claimable', { url: '/api/zcode-start-plan/claimable?id=acc-1' }))
186
+
187
+ assert.equal(res.status, 200)
188
+ assert.equal(res.body.ok, true)
189
+ assert.equal(calls.touch, 1, '发现走 marketing/touch(官方同款)')
190
+ assert.equal(calls.report, 2, 'reportActivation 仍会补两个活跃事件(与官方启动行为一致)')
191
+ assert.deepEqual(
192
+ res.body.plans.map((plan) => plan.planId),
193
+ ['plan-high', 'plan-low'],
194
+ 'priority 降序',
195
+ )
196
+ assert.equal(res.body.plans[0].campaignId, 'camp-high', 'campaignId 供 action 上报')
197
+ })
198
+
199
+ /**
200
+ * ⚠ 语义变更(2026-10-28):`/claim` 不再「先查 preview 再领」。
201
+ *
202
+ * 实证:官方 ZCode 客户端全天 0 次调用 `getManualClaimPlanPreviews`
203
+ * (`/billing/preview`),点击时直接调 `claimManualPlan`(`/billing/claim`)。
204
+ * 我们照抄源码里存在但从未被使用的方法,导致面板永远「暂无可领取」。
205
+ *
206
+ * 新语义:`planId` 必填,直接 claim,业务码原样回传。
207
+ * 「有没有名额」由服务端裁决(0 成功 / 1003 已领过 / 1005 领完)。
208
+ */
209
+ test('/claim: 直接按 planId 领取,不碰 preview', async () => {
210
+ const { fetchImpl, client, calls } = makeUpstream({ claimCodes: [0] })
211
+ const routes = buildRoutes(client)
212
+ const res = await withGlobalFetch(fetchImpl, () =>
213
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
214
+ )
215
+
216
+ assert.equal(res.status, 200)
217
+ assert.equal(res.body.ok, true)
218
+ assert.deepEqual(calls.claim, ['plan-high'])
219
+ assert.equal(calls.preview, undefined, '绝不调用 /billing/preview —— 官方客户端也不调它')
220
+ assert.equal(calls.touch, 0, '直接领取也不需要先探测(captcha 只为 claim 烧)')
221
+ assert.equal(res.body.results.length, 1)
222
+ assert.equal(res.body.results[0].ok, true)
223
+ })
224
+
225
+ test('/claim: 缺 planId 给 400(不再靠 preview 兜底猜 plan)', async () => {
226
+ const { fetchImpl, client, calls } = makeUpstream()
227
+ const routes = buildRoutes(client)
228
+ const res = await withGlobalFetch(fetchImpl, () =>
229
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1' } }),
230
+ )
231
+ assert.equal(res.status, 400)
232
+ assert.match(res.body.error, /planId/)
233
+ assert.equal(calls.claim.length, 0, '参数不全时不能发 claim(会白发 captcha)')
234
+ })
235
+
236
+ test('/claim: 1003(已领过)算幂等成功,不报错', async () => {
237
+ const { fetchImpl, client } = makeUpstream({ claimCodes: [1003] })
238
+ const routes = buildRoutes(client)
239
+ const res = await withGlobalFetch(fetchImpl, () =>
240
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
241
+ )
242
+
243
+ assert.equal(res.body.ok, true, '已领过不能算失败')
244
+ assert.equal(res.body.results[0].ok, true)
245
+ assert.equal(res.body.results[0].alreadyClaimed, true)
246
+ })
247
+
248
+ test('/claim: captcha 失败只重试一次,仍失败则不碰 claim', async () => {
249
+ const { fetchImpl, client, calls } = makeUpstream({ captchaFails: true })
250
+ const routes = buildRoutes(client)
251
+ const res = await withGlobalFetch(fetchImpl, () =>
252
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
253
+ )
254
+
255
+ assert.equal(res.body.ok, false)
256
+ assert.match(res.body.results[0].error, /captcha 产出失败(尝试 2 次)/)
257
+ assert.equal(calls.claim.length, 0, 'captcha 没拿到就绝不能打 claim(烧设备信誉)')
258
+ })
259
+
260
+ /**
261
+ * ⚠ 「按两次才领到」的服务端侧对策。
262
+ *
263
+ * 官方客户端日志实证(2026-10-28 21:00):一次点击里
264
+ * `send_preflight outcome=error` → 6 秒后 `outcome=success` → 才发 claim。
265
+ * 根因是阿里云 CDN 首轮抖动(连续 4 次 resource.failed,几十到两百毫秒)。
266
+ * 所以我们也要**原地重试一次**,而不是一失败就把错误甩给用户。
267
+ */
268
+ test('/claim: captcha 首次失败、第二次成功 → 正常领取(对应"按两次")', async () => {
269
+ const { fetchImpl, client, calls } = makeUpstream({ claimCodes: [0] })
270
+ let mintCount = 0
271
+ const flakyClient = {
272
+ async mintCaptcha() {
273
+ mintCount += 1
274
+ if (mintCount === 1) throw new Error('阿里云 CDN 抖动(模拟首轮 resource.failed)')
275
+ return { param: `param-retry-${mintCount}`, region: 'cn' }
276
+ },
277
+ }
278
+ const routes = buildRoutes(flakyClient)
279
+ const res = await withGlobalFetch(fetchImpl, () =>
280
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
281
+ )
282
+
283
+ assert.equal(mintCount, 2, 'captcha 必须重试一次')
284
+ assert.equal(res.body.ok, true)
285
+ assert.deepEqual(calls.claim, ['plan-high'])
286
+ assert.equal(calls.captchaHeaders[0], 'param-retry-2', '使用重试拿到的 param')
287
+ })
288
+
289
+ test('/claim: 1005(领完)原样回传业务码,不吞成含糊失败', async () => {
290
+ const { fetchImpl, client } = makeUpstream({ claimCodes: [1005] })
291
+ const routes = buildRoutes(client)
292
+ const res = await withGlobalFetch(fetchImpl, () =>
293
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
294
+ )
295
+ assert.equal(res.body.ok, false)
296
+ assert.equal(res.body.results[0].code, 1005, '业务码必须原样回传,供面板如实显示')
297
+ assert.equal(res.body.results[0].httpStatus, 200)
298
+ })
299
+
300
+ /**
301
+ * confirm 回执纪律(docs/upstream-protocol.md):**只在 `0`/`1003` 后发**。
302
+ * 成功不发 = 服务端重复投放(每轮白烧 captcha);失败发 = 白丢投放机会。
303
+ * 手动 /claim 此前从不发 —— 与 auto-claim 一起在 0.9.7 补齐。
304
+ */
305
+ test('/claim: 成功(0/1003)后发 marketing confirm;失败(1005)不发', async () => {
306
+ const { fetchImpl, client, calls } = makeUpstream({ claimCodes: [0, 1003, 1005] })
307
+ const routes = buildRoutes(client)
308
+ const post = (planId, campaignId) => call(routes, '/api/zcode-start-plan/claim', {
309
+ method: 'POST',
310
+ body: { id: 'acc-1', planId, ...(campaignId !== undefined ? { campaignId } : {}) },
311
+ })
312
+ await withGlobalFetch(fetchImpl, async () => {
313
+ await post('plan-a', 'camp-a')
314
+ await post('plan-b', 'camp-b')
315
+ await post('plan-c', 'camp-c')
316
+ await post('plan-d')
317
+ })
318
+ assert.deepEqual(calls.confirms, ['camp-a', 'camp-b'], '0/1003 各发一次 confirm,带探测给的 campaignId')
319
+ assert.equal(calls.claim.length, 4, '1005 与缺 campaignId 的请求照样领取,只是不发回执')
320
+ })
321
+
322
+ test('/claim: 不带 campaignId 也能领取(老面板兼容),只是不发 confirm', async () => {
323
+ const { fetchImpl, client, calls } = makeUpstream({ claimCodes: [0] })
324
+ const routes = buildRoutes(client)
325
+ const res = await withGlobalFetch(fetchImpl, () =>
326
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: { id: 'acc-1', planId: 'plan-high' } }),
327
+ )
328
+ assert.equal(res.body.ok, true)
329
+ assert.deepEqual(calls.confirms, [])
330
+ })
331
+
332
+ test('/claimable: 账号不存在给 404;未知路径不会误配', async () => {
333
+ const { fetchImpl, client } = makeUpstream()
334
+ const routes = buildRoutes(client)
335
+ const res = await withGlobalFetch(fetchImpl, () =>
336
+ call(routes, '/api/zcode-start-plan/claimable', { url: '/api/zcode-start-plan/claimable?id=nope' }),
337
+ )
338
+ assert.equal(res.status, 404)
339
+ assert.equal(res.body.ok, false)
340
+ })
341
+
342
+ test('/claim: 缺 id 给 400', async () => {
343
+ const { fetchImpl, client } = makeUpstream()
344
+ const routes = buildRoutes(client)
345
+ const res = await withGlobalFetch(fetchImpl, () =>
346
+ call(routes, '/api/zcode-start-plan/claim', { method: 'POST', body: {} }),
347
+ )
348
+ assert.equal(res.status, 400)
349
+ })
350
+
351
+ test('/restart-cdp: 返回可复制的启动命令(不再替用户执行)', async () => {
352
+ const built = []
353
+ const routes = makeManageRoutes({
354
+ pool,
355
+ client: {},
356
+ fetchBalance: async () => undefined,
357
+ settings: {},
358
+ log: () => {},
359
+ buildRestartCommand: (options) => {
360
+ built.push(options)
361
+ return { command: '"DSH.exe" --remote-debugging-port=9333', port: 9333, note: '带端口重启' }
362
+ },
363
+ })
364
+ const res = await call(routes, '/api/zcode-start-plan/restart-cdp', {
365
+ method: 'POST',
366
+ body: { debugPort: 9333 },
367
+ })
368
+ assert.equal(res.status, 200)
369
+ assert.equal(res.body.ok, true)
370
+ assert.equal(res.body.mode, 'debug')
371
+ assert.equal(res.body.command, '"DSH.exe" --remote-debugging-port=9333')
372
+ assert.equal(res.body.port, 9333)
373
+ assert.deepEqual(built, [{ debugPort: 9333 }])
374
+ })
375
+
376
+ /**
377
+ * ⚠ 0.6.4:`debugPort` **省略 = 普通重启**(重载插件,不带调试端口)。
378
+ * 「重载插件」与「开调试端口」是两件事 —— 旧实现无条件 `?? 9229`,
379
+ * 等于把「我只想重载插件」偷偷变成「开调试端口」。
380
+ */
381
+ test('/restart-cdp: 省略 debugPort = 普通重启指引(不带端口)', async () => {
382
+ const built = []
383
+ const routes = makeManageRoutes({
384
+ pool,
385
+ client: {},
386
+ settings: {},
387
+ log: () => {},
388
+ buildRestartCommand: (options) => {
389
+ built.push(options)
390
+ return { command: '"DSH.exe"', port: null, note: '普通重启' }
391
+ },
392
+ })
393
+ const res = await call(routes, '/api/zcode-start-plan/restart-cdp', { method: 'POST', body: {} })
394
+ assert.equal(res.status, 200)
395
+ assert.equal(res.body.mode, 'plain')
396
+ assert.equal(res.body.port, null)
397
+ assert.equal(res.body.command, '"DSH.exe"')
398
+ assert.deepEqual(built, [{}], '普通重启不得给命令生成器传 debugPort')
399
+ })
400
+
401
+ test('/restart-cdp: 非法端口给 400', async () => {
402
+ let called = 0
403
+ const routes = makeManageRoutes({
404
+ pool,
405
+ client: {},
406
+ settings: {},
407
+ log: () => {},
408
+ buildRestartCommand: () => { called += 1; return { command: 'x', port: null, note: '' } },
409
+ })
410
+ const res = await call(routes, '/api/zcode-start-plan/restart-cdp', {
411
+ method: 'POST',
412
+ body: { debugPort: 99999 },
413
+ })
414
+ assert.equal(res.status, 400)
415
+ assert.equal(called, 0)
416
+ })
417
+
418
+ test('/restart-cdp: 宿主没提供命令生成实现时给 501(而不是假装成功)', async () => {
419
+ const routes = makeManageRoutes({ pool, client: {}, settings: {}, log: () => {} })
420
+ const res = await call(routes, '/api/zcode-start-plan/restart-cdp', { method: 'POST', body: {} })
421
+ assert.equal(res.status, 501)
422
+ assert.match(res.body.error, /重启指引不可用/)
423
+ })
424
+
425
+ test('/restart-cdp: 命令生成抛错时把原因透出来', async () => {
426
+ const routes = makeManageRoutes({
427
+ pool,
428
+ client: {},
429
+ settings: {},
430
+ log: () => {},
431
+ buildRestartCommand: () => {
432
+ throw new Error('找不到 DeepSeek Harness.exe')
433
+ },
434
+ })
435
+ const res = await call(routes, '/api/zcode-start-plan/restart-cdp', { method: 'POST', body: { debugPort: 9229 } })
436
+ assert.equal(res.status, 500)
437
+ assert.match(res.body.error, /找不到/)
438
+ })