bailinghub 0.3.1 → 0.3.2-rc.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.
Files changed (63) hide show
  1. package/.env.example +3 -0
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/demo/business/server.mjs +107 -59
  4. package/docs/DEMO.md +25 -0
  5. package/package.json +4 -1
  6. package/scripts/check-package-artifact.mjs +2 -1
  7. package/scripts/check-release-consistency.mjs +57 -23
  8. package/scripts/check-release-consistency.test.mjs +58 -3
  9. package/scripts/seed-demo.ts +24 -99
  10. package/scripts/validate-examples.mjs +6 -4
  11. package/sql/054_demo_dataset_state.sql +12 -0
  12. package/src/app/kernel.ts +3 -0
  13. package/src/core/config/config.test.ts +69 -0
  14. package/src/core/config/config.ts +54 -0
  15. package/src/infrastructure/config/config-chat-repository.ts +12 -1
  16. package/src/infrastructure/config/config-client-repository.ts +21 -2
  17. package/src/infrastructure/config/config-route-repository.ts +12 -1
  18. package/src/infrastructure/config/config-target-repository.ts +12 -1
  19. package/src/infrastructure/config/config-tool-provider-repository.ts +12 -1
  20. package/src/routes/admin-default.ts +2 -0
  21. package/src/routes/admin-demo-dataset.test.ts +93 -0
  22. package/src/routes/admin-demo-dataset.ts +83 -0
  23. package/src/routes/admin-host.test.ts +10 -1
  24. package/src/routes/admin.ts +14 -0
  25. package/src/services/demo-business-profile.test.ts +230 -0
  26. package/src/services/demo-dataset.test.ts +369 -0
  27. package/src/services/demo-dataset.ts +872 -0
  28. package/web/console/assets/{Accounts-Dwzm4D_V.js → Accounts-08VltF2i.js} +1 -1
  29. package/web/console/assets/{Approvals-BxhuI0ku.js → Approvals-CqgmsMau.js} +1 -1
  30. package/web/console/assets/{Audit-dFAbGynl.js → Audit-bPlpSQt3.js} +1 -1
  31. package/web/console/assets/{BrandLockup-BtZyvkM5.js → BrandLockup-DhX07g3G.js} +1 -1
  32. package/web/console/assets/{Channels-Dqg4-_yr.js → Channels-BZe0pLgx.js} +1 -1
  33. package/web/console/assets/{ChatEntries-CEGZ3NnJ.js → ChatEntries-Ca0lcGqn.js} +1 -1
  34. package/web/console/assets/{Clients-C0QD1x7g.js → Clients-BVVZfX3r.js} +1 -1
  35. package/web/console/assets/{Cost-BAJqLhpK.js → Cost-DANcjr_p.js} +1 -1
  36. package/web/console/assets/{Credentials-D_GDRgWi.js → Credentials-D_8tP2Xa.js} +1 -1
  37. package/web/console/assets/{Diagnostics-BWYnDxRj.js → Diagnostics-Bw1WImFe.js} +1 -1
  38. package/web/console/assets/{Executors-Cmryk4Vk.js → Executors-fuieN2Sl.js} +1 -1
  39. package/web/console/assets/{Kb-BSXQE0Fa.js → Kb-BaMi_7xf.js} +1 -1
  40. package/web/console/assets/{Login-BnBPqC8Z.js → Login-Cmz2ppY8.js} +1 -1
  41. package/web/console/assets/{Projects-CNHx4L_7.js → Projects-D6xIgFB3.js} +1 -1
  42. package/web/console/assets/{Routes-u5cEAEXQ.js → Routes-B90i3ZNa.js} +1 -1
  43. package/web/console/assets/{Runs-BeFUR77_.js → Runs-9qpwotOj.js} +1 -1
  44. package/web/console/assets/Setup-BIjCiA2i.js +1 -0
  45. package/web/console/assets/Setup-BuyKFofL.css +1 -0
  46. package/web/console/assets/Shell-BVIjmoY8.css +1 -0
  47. package/web/console/assets/Shell-Dm6eFcl1.js +1 -0
  48. package/web/console/assets/{StorageBuckets-DMXRJxUA.js → StorageBuckets-DY8WuJlM.js} +1 -1
  49. package/web/console/assets/{SystemSettings-B72F-loY.js → SystemSettings-O_NMPzq_.js} +1 -1
  50. package/web/console/assets/{SystemStatus-hOj_TPYE.js → SystemStatus-Cok3S7S3.js} +1 -1
  51. package/web/console/assets/{Targets-UVVf7twC.js → Targets-YWBoxqvy.js} +1 -1
  52. package/web/console/assets/{Tools-ihkr9R9x.js → Tools-BgXDw7Mg.js} +1 -1
  53. package/web/console/assets/{index-DxvruykG.js → index-S_J0I0Zh.js} +2 -2
  54. package/web/console/assets/{request-BisL2T9B.js → request-FM608Kfz.js} +1 -1
  55. package/web/console/assets/{schema-CzpUpoLk.js → schema-DWnFqTkB.js} +1 -1
  56. package/web/console/index.html +1 -1
  57. package/web-admin/package-lock.json +3 -3
  58. package/web-admin/src/layout/Shell.vue +5 -4
  59. package/web-admin/src/pages/Setup.vue +12 -9
  60. package/web/console/assets/Setup-BjZfrmfN.js +0 -1
  61. package/web/console/assets/Setup-QjlHZKdB.css +0 -1
  62. package/web/console/assets/Shell-CbGNTN91.css +0 -1
  63. package/web/console/assets/Shell-EJuYf3OO.js +0 -1
@@ -0,0 +1,83 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { can, type Principal } from '../app/auth';
3
+ import { send } from '../app/http';
4
+ import {
5
+ DemoDatasetConflictError,
6
+ DemoDatasetUnavailableError,
7
+ type DemoDatasetClearResult,
8
+ type DemoDatasetImportResult,
9
+ type DemoDatasetStatus,
10
+ } from '../services/demo-dataset';
11
+
12
+ export interface DemoDatasetServiceContract {
13
+ status(): Promise<DemoDatasetStatus>;
14
+ import(): Promise<DemoDatasetImportResult>;
15
+ clear(): Promise<DemoDatasetClearResult>;
16
+ }
17
+
18
+ export interface AdminDemoDatasetApiDeps {
19
+ demoDataset: DemoDatasetServiceContract;
20
+ refreshTargets(): Promise<void>;
21
+ }
22
+
23
+ const WRITE_PERMISSIONS = ['targets:write', 'tools:write', 'routes:write', 'clients:write'] as const;
24
+
25
+ function canWriteDemoDataset(principal: Principal): boolean {
26
+ return WRITE_PERMISSIONS.every((permission) => can(principal, permission));
27
+ }
28
+
29
+ export async function handleAdminDemoDatasetApiFor(
30
+ deps: AdminDemoDatasetApiDeps,
31
+ method: string,
32
+ path: string,
33
+ _req: IncomingMessage,
34
+ res: ServerResponse,
35
+ principal: Principal,
36
+ ): Promise<boolean> {
37
+ if (!(path === '/admin/api/demo-dataset'
38
+ || path === '/admin/api/demo-dataset/status'
39
+ || path === '/admin/api/demo-dataset/import')) return false;
40
+
41
+ const statusRequest = path === '/admin/api/demo-dataset/status' && method === 'GET';
42
+ const importRequest = path === '/admin/api/demo-dataset/import' && method === 'POST';
43
+ const clearRequest = path === '/admin/api/demo-dataset' && method === 'DELETE';
44
+ if (!statusRequest && !importRequest && !clearRequest) {
45
+ res.setHeader('allow', path.endsWith('/status') ? 'GET' : path.endsWith('/import') ? 'POST' : 'DELETE');
46
+ send(res, 405, { error: 'method not allowed' });
47
+ return true;
48
+ }
49
+
50
+ if (statusRequest
51
+ ? !(can(principal, 'audit:read') || canWriteDemoDataset(principal))
52
+ : !canWriteDemoDataset(principal)) {
53
+ send(res, 403, { error: '当前角色无演示数据管理权限' });
54
+ return true;
55
+ }
56
+
57
+ try {
58
+ if (statusRequest) {
59
+ send(res, 200, await deps.demoDataset.status());
60
+ return true;
61
+ }
62
+ if (importRequest) {
63
+ const result = await deps.demoDataset.import();
64
+ await deps.refreshTargets();
65
+ send(res, 200, result);
66
+ return true;
67
+ }
68
+ const result = await deps.demoDataset.clear();
69
+ await deps.refreshTargets();
70
+ send(res, 200, result);
71
+ return true;
72
+ } catch (error) {
73
+ if (error instanceof DemoDatasetConflictError) {
74
+ send(res, 409, { error: error.message, conflicts: error.conflicts });
75
+ return true;
76
+ }
77
+ if (error instanceof DemoDatasetUnavailableError) {
78
+ send(res, 503, { error: error.message });
79
+ return true;
80
+ }
81
+ throw error;
82
+ }
83
+ }
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
2
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
3
  import test from 'node:test';
4
4
  import type { Principal } from '../app/auth';
5
- import { adminSmokeHub, handleAdminApiFor, type AdminApiDeps } from './admin';
5
+ import { adminSmokeHub, adminSmokeRunInput, handleAdminApiFor, type AdminApiDeps } from './admin';
6
6
 
7
7
  function response() {
8
8
  let status = 0;
@@ -35,6 +35,15 @@ test('admin smoke loopback includes the trusted Kernel mount prefix', () => {
35
35
  );
36
36
  });
37
37
 
38
+ test('admin smoke uses a read-only request for the stateless demo profile', () => {
39
+ assert.match(adminSmokeRunInput({ demoDataset: {
40
+ businessBaseUrl: 'http://127.0.0.1:19080',
41
+ toolSecret: 'not-returned',
42
+ profile: 'stateless-readonly',
43
+ } }) ?? '', /只查询订单 SO-1001/);
44
+ assert.equal(adminSmokeRunInput({ demoDataset: null }), undefined);
45
+ });
46
+
38
47
  test('host identity cannot reach dead Core-local password or account APIs', async () => {
39
48
  for (const [method, path] of [
40
49
  ['POST', '/admin/api/password'],
@@ -19,6 +19,7 @@ import { handleAdminKbApiFor } from './admin-kb';
19
19
  import { handleAdminRuntimeApiFor } from './admin-runtime';
20
20
  import { handleAdminToolProviderApiFor } from './admin-tool-providers';
21
21
  import { handleAdminBrandingApiFor } from './admin-branding';
22
+ import { handleAdminDemoDatasetApiFor, type DemoDatasetServiceContract } from './admin-demo-dataset';
22
23
  import { refreshTargets, type TargetRegistry } from '../core/targets/registry';
23
24
  import type { AppConfig } from '../core/config/config';
24
25
  import type { RuntimeStateStore } from '../core/state/state-contracts';
@@ -52,12 +53,20 @@ export interface AdminApiDeps {
52
53
  httpMountPath?: string;
53
54
  /** False when a Host identity provider owns human accounts and passwords. */
54
55
  localAdminManagement?: boolean;
56
+ /** Core-native demo dataset service; only available with the MySQL config store. */
57
+ demoDataset: DemoDatasetServiceContract | null;
55
58
  }
56
59
 
57
60
  export function adminSmokeHub(cfg: Pick<AppConfig, 'server'>, httpMountPath?: string): string {
58
61
  return `http://127.0.0.1:${cfg.server.port}${normalizeHttpMountPath(httpMountPath)}`;
59
62
  }
60
63
 
64
+ export function adminSmokeRunInput(cfg: Pick<AppConfig, 'demoDataset'>): string | undefined {
65
+ return cfg.demoDataset?.profile === 'stateless-readonly'
66
+ ? 'smoke test: 只查询订单 SO-1001 并返回订单状态'
67
+ : undefined;
68
+ }
69
+
61
70
  // ---- web 配置后台 API(管理项目/路由/接入方,查看任务)----
62
71
  export async function handleAdminApiFor(deps: AdminApiDeps, method: string, path: string, req: IncomingMessage, res: ServerResponse, principal: Principal): Promise<boolean> {
63
72
  if (deps.localAdminManagement === false && (path === '/admin/api/password' || /^\/admin\/api\/admins(?:\/|$)/.test(path))) {
@@ -81,6 +90,10 @@ export async function handleAdminApiFor(deps: AdminApiDeps, method: string, path
81
90
  send(res, 200, deps.capabilities);
82
91
  return true;
83
92
  }
93
+ if (deps.demoDataset && await handleAdminDemoDatasetApiFor(
94
+ { demoDataset: deps.demoDataset, refreshTargets: deps.refreshTargets },
95
+ method, path, req, res, principal,
96
+ )) return true;
84
97
  // 权限闸门:板块:动作 不在角色权限集内一律 403
85
98
  const deny = (): true => { send(res, 403, { error: '当前角色无此权限' }); return true; };
86
99
  const PERM_RULES: Array<[RegExp, string, string]> = [ // [路径, GET 所需权限, 写操作所需权限]
@@ -155,6 +168,7 @@ export async function handleAdminApiFor(deps: AdminApiDeps, method: string, path
155
168
  tenantId,
156
169
  runRoute: demo?.route,
157
170
  runToken: demo?.token,
171
+ runInput: adminSmokeRunInput(deps.cfg),
158
172
  waitMs: 20_000,
159
173
  }));
160
174
  return true;
@@ -0,0 +1,230 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawn, spawnSync, type ChildProcess } from 'node:child_process';
3
+ import { once } from 'node:events';
4
+ import { createServer } from 'node:net';
5
+ import { fileURLToPath } from 'node:url';
6
+ import test from 'node:test';
7
+ import { signToolCall } from '../core/contracts/tools';
8
+ import { demoToolSpec } from './demo-dataset';
9
+
10
+ const serverPath = fileURLToPath(new URL('../../demo/business/server.mjs', import.meta.url));
11
+ const strongSecret = '4f7b2c91a8d03e65b49c27e018f3d6aa';
12
+
13
+ async function unusedPort(): Promise<number> {
14
+ const reservation = createServer();
15
+ await new Promise<void>((resolve, reject) => {
16
+ reservation.once('error', reject);
17
+ reservation.listen(0, '127.0.0.1', resolve);
18
+ });
19
+ const address = reservation.address();
20
+ assert.ok(address && typeof address === 'object');
21
+ const port = address.port;
22
+ await new Promise<void>((resolve, reject) => reservation.close((error) => error ? reject(error) : resolve()));
23
+ return port;
24
+ }
25
+
26
+ async function waitUntilReady(child: ChildProcess, baseUrl: string, stderr: () => string): Promise<void> {
27
+ for (let attempt = 0; attempt < 100; attempt++) {
28
+ if (child.exitCode !== null) throw new Error(`demo business 提前退出 (${child.exitCode}): ${stderr()}`);
29
+ try {
30
+ const response = await fetch(`${baseUrl}/health`);
31
+ if (response.ok) return;
32
+ } catch {
33
+ // 子进程刚启动时连接拒绝属于正常竞态,短暂重试。
34
+ }
35
+ await new Promise((resolve) => setTimeout(resolve, 20));
36
+ }
37
+ throw new Error(`demo business 启动超时: ${stderr()}`);
38
+ }
39
+
40
+ async function stop(child: ChildProcess): Promise<void> {
41
+ if (child.exitCode !== null) return;
42
+ const exited = once(child, 'exit');
43
+ child.kill('SIGTERM');
44
+ await exited;
45
+ }
46
+
47
+ function signedHeaders(
48
+ method: string,
49
+ pathWithQuery: string,
50
+ body: string,
51
+ subject = 'demo-user-001',
52
+ jobId = 'contract-test',
53
+ signingSecret = strongSecret,
54
+ ): Record<string, string> {
55
+ const timestamp = Math.floor(Date.now() / 1000);
56
+ return {
57
+ 'content-type': 'application/json',
58
+ 'x-bailing-timestamp': String(timestamp),
59
+ 'x-bailing-signature': signToolCall(signingSecret, timestamp, method, pathWithQuery, body, subject, jobId),
60
+ 'x-bailing-on-behalf-of': subject,
61
+ 'x-bailing-job-id': jobId,
62
+ };
63
+ }
64
+
65
+ test('demo business stateless-readonly: 只暴露签名只读工具,不暴露或积累可变状态', { timeout: 10_000 }, async () => {
66
+ const port = await unusedPort();
67
+ let stderr = '';
68
+ const child = spawn(process.execPath, [serverPath], {
69
+ env: {
70
+ ...process.env,
71
+ DEMO_HOST: '127.0.0.1',
72
+ DEMO_PORT: String(port),
73
+ DEMO_PROFILE: 'stateless-readonly',
74
+ DEMO_TOOL_SECRET: strongSecret,
75
+ // 即使这两项是无效值,只读 profile 也不应触达 Hub 或 client token 路径。
76
+ DEMO_HUB_URL: 'http://127.0.0.1:1',
77
+ DEMO_CLIENT_TOKEN: 'must-not-be-used',
78
+ },
79
+ stdio: ['ignore', 'pipe', 'pipe'],
80
+ });
81
+ child.stderr.setEncoding('utf8');
82
+ child.stderr.on('data', (chunk: string) => { stderr += chunk; });
83
+ const baseUrl = `http://127.0.0.1:${port}`;
84
+
85
+ try {
86
+ await waitUntilReady(child, baseUrl, () => stderr);
87
+
88
+ const healthResponse = await fetch(`${baseUrl}/health`);
89
+ assert.equal(healthResponse.status, 200);
90
+ assert.deepEqual(await healthResponse.json(), { ok: true, app: 'demo-business', profile: 'stateless-readonly' });
91
+
92
+ const rootResponse = await fetch(`${baseUrl}/`);
93
+ assert.equal(rootResponse.status, 200);
94
+ const root = await rootResponse.text();
95
+ assert.doesNotMatch(root, new RegExp('批准|拒绝|authorization: Bearer|/console/'));
96
+
97
+ const specResponse = await fetch(`${baseUrl}/.well-known/bailing/tools.json`);
98
+ assert.equal(specResponse.status, 200);
99
+ const spec = await specResponse.json();
100
+ assert.deepEqual(spec, demoToolSpec('stateless-readonly'));
101
+ assert.deepEqual(Object.keys((spec as { paths: object }).paths).sort(), ['/failure-demo', '/orders']);
102
+
103
+ const probeBody = JSON.stringify({ subject: 'demo-user-001' });
104
+ const probePath = '/.well-known/bailing/authz-probe';
105
+ const probeResponse = await fetch(`${baseUrl}${probePath}`, {
106
+ method: 'POST',
107
+ headers: signedHeaders('POST', probePath, probeBody, 'demo-user-001', 'probe-test'),
108
+ body: probeBody,
109
+ });
110
+ assert.equal(probeResponse.status, 200);
111
+ assert.deepEqual(await probeResponse.json(), { authorized: true, subject: 'demo-user-001' });
112
+
113
+ const orderPath = '/orders?order_no=SO-1001';
114
+ const orderResponse = await fetch(`${baseUrl}${orderPath}`, {
115
+ headers: signedHeaders('GET', orderPath, ''),
116
+ });
117
+ assert.equal(orderResponse.status, 200);
118
+ const orderResult = await orderResponse.json() as { subject: string; orders: Array<{ order_no: string }> };
119
+ assert.equal(orderResult.subject, 'demo-user-001');
120
+ assert.deepEqual(orderResult.orders.map((order) => order.order_no), ['SO-1001']);
121
+
122
+ const failurePath = '/failure-demo';
123
+ const failureResponse = await fetch(`${baseUrl}${failurePath}`, {
124
+ headers: signedHeaders('GET', failurePath, ''),
125
+ });
126
+ assert.equal(failureResponse.status, 500);
127
+
128
+ const mutableRequests: Array<[string, RequestInit]> = [
129
+ ['/api/state', {}],
130
+ ['/tickets', { method: 'POST', body: '{}' }],
131
+ ['/refunds', { method: 'POST', body: '{}' }],
132
+ ['/approvals', { method: 'POST', body: '{}' }],
133
+ ['/api/approvals/1/decision', { method: 'POST', body: 'decision=approved' }],
134
+ ];
135
+ for (const [path, init] of mutableRequests) {
136
+ const response = await fetch(`${baseUrl}${path}`, init);
137
+ assert.equal(response.status, 404, `${path} 在 stateless-readonly 下必须隐藏`);
138
+ }
139
+ } finally {
140
+ await stop(child);
141
+ }
142
+ });
143
+
144
+ test('demo business 默认 profile 保持 full-local 工单与状态演示能力', { timeout: 10_000 }, async () => {
145
+ const port = await unusedPort();
146
+ let stderr = '';
147
+ const env = { ...process.env };
148
+ delete env.DEMO_PROFILE;
149
+ delete env.DEMO_TOOL_SECRET;
150
+ const child = spawn(process.execPath, [serverPath], {
151
+ env: {
152
+ ...env,
153
+ DEMO_HOST: '127.0.0.1',
154
+ DEMO_PORT: String(port),
155
+ },
156
+ stdio: ['ignore', 'pipe', 'pipe'],
157
+ });
158
+ child.stderr.setEncoding('utf8');
159
+ child.stderr.on('data', (chunk: string) => { stderr += chunk; });
160
+ const baseUrl = `http://127.0.0.1:${port}`;
161
+
162
+ try {
163
+ await waitUntilReady(child, baseUrl, () => stderr);
164
+ const healthResponse = await fetch(`${baseUrl}/health`);
165
+ assert.deepEqual(await healthResponse.json(), { ok: true, app: 'demo-business', profile: 'full-local' });
166
+
167
+ const specResponse = await fetch(`${baseUrl}/.well-known/bailing/tools.json`);
168
+ assert.deepEqual(await specResponse.json(), demoToolSpec('full-local'));
169
+
170
+ const ticketPath = '/tickets';
171
+ const ticketBody = JSON.stringify({ order_no: 'SO-1001', title: '需要人工跟进', message: '本地完整 demo 回归' });
172
+ const ticketResponse = await fetch(`${baseUrl}${ticketPath}`, {
173
+ method: 'POST',
174
+ headers: signedHeaders('POST', ticketPath, ticketBody, 'demo-user-001', 'full-local-test', 'demo-tool-secret-change-me'),
175
+ body: ticketBody,
176
+ });
177
+ assert.equal(ticketResponse.status, 200);
178
+
179
+ const stateResponse = await fetch(`${baseUrl}/api/state`);
180
+ assert.equal(stateResponse.status, 200);
181
+ const state = await stateResponse.json() as { tickets: Array<{ order_no: string }> };
182
+ assert.deepEqual(state.tickets.map((ticket) => ticket.order_no), ['SO-1001']);
183
+ } finally {
184
+ await stop(child);
185
+ }
186
+ });
187
+
188
+ test('demo business stateless-readonly: 弱密钥和占位符启动时 fail-fast', () => {
189
+ const weakSecrets = [
190
+ 'short-secret',
191
+ ' ',
192
+ 'demo-tool-secret-change-me',
193
+ 'test-secret-that-is-long-enough',
194
+ 'example-secret-that-is-long-enough',
195
+ 'change-this-secret-right-now',
196
+ 'replace-this-secret-right-now',
197
+ 'REPLACE_WITH_32_BYTE_INDEPENDENT_DEMO_TOOL_SECRET',
198
+ ];
199
+ for (const weakSecret of weakSecrets) {
200
+ const result = spawnSync(process.execPath, [serverPath], {
201
+ env: {
202
+ ...process.env,
203
+ DEMO_HOST: '127.0.0.1',
204
+ DEMO_PORT: '0',
205
+ DEMO_PROFILE: 'stateless-readonly',
206
+ DEMO_TOOL_SECRET: weakSecret,
207
+ },
208
+ encoding: 'utf8',
209
+ timeout: 2_000,
210
+ });
211
+ assert.notEqual(result.status, 0, `弱密钥 ${weakSecret} 不应启动成功`);
212
+ assert.match(result.stderr, /DEMO_TOOL_SECRET 不安全/);
213
+ }
214
+ });
215
+
216
+ test('demo business stateless-readonly: 拒绝绑定非回环地址', () => {
217
+ const result = spawnSync(process.execPath, [serverPath], {
218
+ env: {
219
+ ...process.env,
220
+ DEMO_HOST: '0.0.0.0',
221
+ DEMO_PORT: '0',
222
+ DEMO_PROFILE: 'stateless-readonly',
223
+ DEMO_TOOL_SECRET: strongSecret,
224
+ },
225
+ encoding: 'utf8',
226
+ timeout: 2_000,
227
+ });
228
+ assert.notEqual(result.status, 0);
229
+ assert.match(result.stderr, /DEMO_HOST 必须是本机回环地址/);
230
+ });