@dsh-workbench/module-tools 1.2.0 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/module-tools",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "模块包的构建与门禁工具:build(单文件 ESM 宿主侧 + 套 loader 壳的浏览器侧)、check(契约/产物边界/源码边界/卡片渲染)。模块包不再各带一份构建脚本。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "semver": "^7.8.5",
34
34
  "typescript": "5.9.3",
35
35
  "typescript-eslint": "^8.71.0",
36
- "@dsh-workbench/shared": "1.2.0"
36
+ "@dsh-workbench/shared": "1.2.2"
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",
@@ -367,6 +367,23 @@ const PROBE_LONG_TASKS = [
367
367
  step: '完成',
368
368
  steps: [],
369
369
  },
370
+ {
371
+ unit: 'probe',
372
+ id: 'run-3',
373
+ workspace: '/tmp/repo',
374
+ target: 'probe-waiting',
375
+ status: 'needs-human',
376
+ step: '等确认',
377
+ steps: ['等确认'],
378
+ intervention: {
379
+ title: '去控制台确认发布',
380
+ hint: '发布会话还等着你点「确认」',
381
+ actions: [
382
+ { kind: 'open-url', url: 'https://example.test/console' },
383
+ { kind: 'copy', text: 'release-session-123' },
384
+ ],
385
+ },
386
+ },
370
387
  ];
371
388
 
372
389
  const PROBE_VIEW = {
@@ -193,6 +193,9 @@ function fakeLongTasks(created) {
193
193
  live: () => [],
194
194
  stop: () => false,
195
195
  onChange: () => () => {},
196
+ recheck: () => false,
197
+ answer: () => false,
198
+ answerable: false,
196
199
  };
197
200
  },
198
201
  };
@@ -309,7 +312,7 @@ function mountOf(face, created, manifest, tools) {
309
312
  }
310
313
  }
311
314
 
312
- const LONG_TASK_METHODS = ['start', 'snapshot', 'active', 'current', 'live', 'stop', 'onChange'];
315
+ const LONG_TASK_METHODS = ['start', 'snapshot', 'active', 'current', 'live', 'stop', 'onChange', 'recheck', 'answer'];
313
316
 
314
317
  const LONG_TASK_RENDERERS = ['useLongTask', 'LongTaskRow', 'longTaskDot'];
315
318
 
@@ -736,7 +739,7 @@ export async function run() {
736
739
  const missing = LONG_TASK_METHODS.filter((method) => typeof registry[method] !== 'function');
737
740
  if (missing.length > 0) {
738
741
  problems.push(
739
- `${name}: 长任务注册表缺方法 ${missing.join(' / ')} —— 外壳按它给这个单元投影出 /runs 路由(停止那颗钮也按它发),` +
742
+ `${name}: 长任务注册表缺方法 ${missing.join(' / ')} —— 外壳按它给这个单元投影出 /runs 路由(停止 / 我处理完了 / 回执三颗钮也按它发),` +
740
743
  `kit 的 useLongTask 与左栏会话行那颗 loading 点读的也是它(后者走 \`live()\`;注册表用 ` +
741
744
  `@dsh-workbench/shared/host 的 createLongTaskRegistry 建)`,
742
745
  );
@@ -761,7 +764,7 @@ export async function run() {
761
764
  if (!LONG_TASK_RENDERERS.some((one) => clientText.includes(one))) {
762
765
  problems.push(
763
766
  `${name}: 注册了长任务,但客户端产物里没有 ${LONG_TASK_RENDERERS.join(' / ')}(kit 里那套)—— ` +
764
- `用户点完只看得到"没反应",看不到进行中 / 要登录 / 停下的 / 完成 / 出错`,
767
+ `用户点完只看得到"没反应",看不到进行中 / 等人处理 / 要登录 / 停下的 / 完成 / 出错`,
765
768
  );
766
769
  }
767
770
  }
@@ -17,20 +17,22 @@ describe('样板流程的模型', () => {
17
17
  expect(flow.target).toEqual({ $ref: 'in.path' });
18
18
  });
19
19
 
20
- it('只有 running / needs-login 算还在跑', () => {
20
+ it('running / needs-human / needs-login 都算还在跑', () => {
21
21
  expect(runIsLive(run())).toBe(true);
22
+ expect(runIsLive(run({ status: 'needs-human' }))).toBe(true);
22
23
  expect(runIsLive(run({ status: 'needs-login' }))).toBe(true);
23
24
  expect(runIsLive(run({ status: 'ok' }))).toBe(false);
24
25
  expect(runIsLive(run({ status: 'failed' }))).toBe(false);
25
26
  expect(runIsLive(run({ status: 'stopped' }))).toBe(false);
26
27
  });
27
28
 
28
- it('标题按五态与当前步骤说人话', () => {
29
+ it('标题按六态与当前步骤说人话', () => {
29
30
  expect(headlineOf(run())).toBe('样板流程正在跑');
30
31
  expect(headlineOf(run({ step: '读目录' }))).toBe('样板流程:读目录');
31
32
  expect(headlineOf(run({ status: 'ok' }))).toBe('样板流程跑完了');
32
33
  expect(headlineOf(run({ status: 'failed' }))).toBe('样板流程失败');
33
34
  expect(headlineOf(run({ status: 'stopped' }))).toBe('样板流程已停止');
35
+ expect(headlineOf(run({ status: 'needs-human' }))).toBe('样板流程在等人处理');
34
36
  expect(headlineOf(run({ status: 'needs-login' }))).toBe('样板流程要登录');
35
37
  });
36
38
  });
@@ -38,10 +38,11 @@ export function headlineOf(run: SampleRun): string {
38
38
  if (run.status === 'ok') return '样板流程跑完了';
39
39
  if (run.status === 'failed') return '样板流程失败';
40
40
  if (run.status === 'stopped') return '样板流程已停止';
41
+ if (run.status === 'needs-human') return '样板流程在等人处理';
41
42
  if (run.status === 'needs-login') return '样板流程要登录';
42
43
  return run.step === '' ? '样板流程正在跑' : `样板流程:${run.step}`;
43
44
  }
44
45
 
45
46
  export function runIsLive(run: SampleRun): boolean {
46
- return run.status === 'running' || run.status === 'needs-login';
47
+ return run.status === 'running' || run.status === 'needs-human' || run.status === 'needs-login';
47
48
  }