@dsh-workbench/core 0.2.11 → 0.2.12

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.
@@ -5,7 +5,6 @@ import * as apiModule from '@dsh-workbench/shared';
5
5
  import * as chipsModule from '../shared/api/context-chips';
6
6
  import * as apiResourceModule from '../shared/hooks/use-api-resource';
7
7
  import * as cardSummaryModule from '../shared/hooks/use-card-summary';
8
- import * as fixturePickModule from '../shared/hooks/use-fixture-pick';
9
8
  import * as hostWriteModule from '../shared/hooks/use-host-write';
10
9
  import * as longTaskModule from '../shared/hooks/use-long-task';
11
10
  import * as capabilityGateModule from '../shared/hooks/use-capability-gate';
@@ -23,8 +22,6 @@ export declare const kit: {
23
22
  readonly fixture?: apiModule.CapabilityPayload | undefined;
24
23
  }): capabilityGateModule.CapabilityGate;
25
24
  useCapabilityMap(refreshToken: number): capabilityGateModule.CapabilityMapView;
26
- mockModeOn(search: string): boolean;
27
- crashModeOn(search: string): boolean;
28
25
  useLongTask<T extends {
29
26
  readonly id: string;
30
27
  readonly status: apiModule.LongTaskStatus;
@@ -39,7 +36,6 @@ export declare const kit: {
39
36
  useFactRevision(fact: string): number;
40
37
  subscribeFactRevision(fact: string, listener: () => void): () => void;
41
38
  useFactInvalidate(): (fact?: string) => void;
42
- useFixturePick<T extends fixturePickModule.PickableFixture>(options: fixturePickModule.FixturePickOptions<T>): fixturePickModule.FixturePick<T>;
43
39
  useCardSummary(onSummary: (summary: cardSummaryModule.CardSummary) => void, summary: {
44
40
  readonly refreshing: boolean;
45
41
  readonly at: number | null | undefined;
@@ -114,20 +110,6 @@ export declare const kit: {
114
110
  CardHead({ t, title, meta, refreshing, onRefresh, gear, gearOpen, onToggleGear, platformHref, platform, platformTitle, }: apiModule.CardHeadProps): JSX.Element;
115
111
  ChoiceGroup(props: apiModule.ChoiceGroupProps): JSX.Element;
116
112
  LongTaskRow(props: apiModule.LongTaskRowProps): JSX.Element;
117
- MockStrip({ mocks, index, onPick, note, real, }: {
118
- readonly mocks: readonly {
119
- readonly id: string;
120
- readonly label: string;
121
- }[];
122
- readonly index: number;
123
- readonly onPick: (next: number) => void;
124
- readonly note?: string;
125
- readonly real?: {
126
- readonly label: string;
127
- readonly active: boolean;
128
- readonly onPick: () => void;
129
- } | undefined;
130
- }): JSX.Element;
131
113
  Note({ tone, as, role, children }: apiModule.NoteProps): JSX.Element;
132
114
  SkeletonRows({ rows }: {
133
115
  rows?: number;
@@ -1101,20 +1083,6 @@ export declare const kit: {
1101
1083
  CardHead({ t, title, meta, refreshing, onRefresh, gear, gearOpen, onToggleGear, platformHref, platform, platformTitle, }: apiModule.CardHeadProps): JSX.Element;
1102
1084
  ChoiceGroup(props: apiModule.ChoiceGroupProps): JSX.Element;
1103
1085
  LongTaskRow(props: apiModule.LongTaskRowProps): JSX.Element;
1104
- MockStrip({ mocks, index, onPick, note, real, }: {
1105
- readonly mocks: readonly {
1106
- readonly id: string;
1107
- readonly label: string;
1108
- }[];
1109
- readonly index: number;
1110
- readonly onPick: (next: number) => void;
1111
- readonly note?: string;
1112
- readonly real?: {
1113
- readonly label: string;
1114
- readonly active: boolean;
1115
- readonly onPick: () => void;
1116
- } | undefined;
1117
- }): JSX.Element;
1118
1086
  Note({ tone, as, role, children }: apiModule.NoteProps): JSX.Element;
1119
1087
  SkeletonRows({ rows }: {
1120
1088
  rows?: number;
@@ -2083,20 +2051,6 @@ export declare const kit: {
2083
2051
  CardHead({ t, title, meta, refreshing, onRefresh, gear, gearOpen, onToggleGear, platformHref, platform, platformTitle, }: apiModule.CardHeadProps): JSX.Element;
2084
2052
  ChoiceGroup(props: apiModule.ChoiceGroupProps): JSX.Element;
2085
2053
  LongTaskRow(props: apiModule.LongTaskRowProps): JSX.Element;
2086
- MockStrip({ mocks, index, onPick, note, real, }: {
2087
- readonly mocks: readonly {
2088
- readonly id: string;
2089
- readonly label: string;
2090
- }[];
2091
- readonly index: number;
2092
- readonly onPick: (next: number) => void;
2093
- readonly note?: string;
2094
- readonly real?: {
2095
- readonly label: string;
2096
- readonly active: boolean;
2097
- readonly onPick: () => void;
2098
- } | undefined;
2099
- }): JSX.Element;
2100
2054
  Note({ tone, as, role, children }: apiModule.NoteProps): JSX.Element;
2101
2055
  SkeletonRows({ rows }: {
2102
2056
  rows?: number;
@@ -1,5 +1,5 @@
1
1
  import type { UnitManifest } from '@dsh-workbench/shared';
2
- import type { BoardShape } from './board-plan';
2
+ import type { BoardShape } from './board-shape';
3
3
  export interface BoardMockExpect {
4
4
  readonly cards: number;
5
5
  readonly empty: boolean;
@@ -1,18 +1,6 @@
1
1
  import type { BoardModule } from '@dsh-workbench/shared';
2
- export type BoardShape = {
3
- readonly kind: 'real';
4
- } | {
5
- readonly kind: 'empty';
6
- } | {
7
- readonly kind: 'unread';
8
- } | {
9
- readonly kind: 'kit';
10
- } | {
11
- readonly kind: 'all';
12
- } | {
13
- readonly kind: 'copies';
14
- readonly count: number;
15
- };
2
+ import type { BoardShape } from './board-shape';
3
+ export type { BoardShape };
16
4
  export interface RealBoard {
17
5
  readonly modules: readonly BoardModule[];
18
6
  readonly configRead: boolean;
@@ -0,0 +1,14 @@
1
+ export type BoardShape = {
2
+ readonly kind: 'real';
3
+ } | {
4
+ readonly kind: 'empty';
5
+ } | {
6
+ readonly kind: 'unread';
7
+ } | {
8
+ readonly kind: 'kit';
9
+ } | {
10
+ readonly kind: 'all';
11
+ } | {
12
+ readonly kind: 'copies';
13
+ readonly count: number;
14
+ };
@@ -0,0 +1,15 @@
1
+ import '@/shared/styles/mock-strip.css';
2
+ export declare function MockStrip({ mocks, index, onPick, note, real, }: {
3
+ readonly mocks: readonly {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ }[];
7
+ readonly index: number;
8
+ readonly onPick: (next: number) => void;
9
+ readonly note?: string;
10
+ readonly real?: {
11
+ readonly label: string;
12
+ readonly active: boolean;
13
+ readonly onPick: () => void;
14
+ } | undefined;
15
+ }): JSX.Element;
@@ -0,0 +1,53 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BoardModule, UnitManifest } from '@dsh-workbench/shared';
3
+ import type { PreflightSnapshot } from '../shared/api/host/preflight';
4
+ import type { BoardShape } from '../app/layouts/rightbar/board-shape';
5
+ import type { AddModuleMock } from '../app/layouts/market/add-module-mock';
6
+ import type { AddModuleState } from '../app/layouts/market/use-add-module';
7
+ export interface DevPickable {
8
+ readonly id: string;
9
+ readonly label: string;
10
+ }
11
+ export interface DevPickOptions<T extends DevPickable> {
12
+ readonly fixtures: readonly T[];
13
+ readonly selected?: string | null | undefined;
14
+ readonly onSelect?: ((id: string | null) => void) | undefined;
15
+ readonly enabled?: boolean | undefined;
16
+ readonly initial?: string | null | undefined;
17
+ }
18
+ export interface DevPick<T extends DevPickable> {
19
+ readonly enabled: boolean;
20
+ readonly active: string | null;
21
+ readonly current: T | undefined;
22
+ readonly nonce: number;
23
+ readonly index: number;
24
+ pick(id: string | null): void;
25
+ }
26
+ export interface DevStrips<T extends DevPickable> {
27
+ readonly pick: DevPick<T>;
28
+ readonly current: T | undefined;
29
+ readonly enabled: boolean;
30
+ readonly strip: ReactNode;
31
+ }
32
+ export interface DevBoard {
33
+ readonly shape: BoardShape;
34
+ readonly seed: readonly BoardModule[];
35
+ readonly strip: (show: boolean) => ReactNode;
36
+ readonly mode: boolean;
37
+ }
38
+ export type DevStripSite = 'panel' | 'market' | 'addModule';
39
+ export interface DevSurface {
40
+ on(search: string): boolean;
41
+ crash(search: string): boolean;
42
+ useBoard(input: {
43
+ readonly manifests: readonly UnitManifest[];
44
+ readonly all: readonly BoardModule[];
45
+ readonly search: string;
46
+ }): DevBoard;
47
+ useStrips<T extends DevPickable>(site: DevStripSite, manifests: readonly UnitManifest[]): DevStrips<T>;
48
+ addModuleState(base: AddModuleState, mock: AddModuleMock): AddModuleState;
49
+ gateStrip(options: {
50
+ readonly onPick: (snapshot: PreflightSnapshot | null) => void;
51
+ }): HTMLElement | null;
52
+ readonly kitModule: BoardModule | null;
53
+ }
@@ -0,0 +1,2 @@
1
+ import type { DevSurface } from './surface-types';
2
+ export declare const devSurface: DevSurface;
@@ -0,0 +1,2 @@
1
+ import type { DevSurface } from './surface-types';
2
+ export declare const devSurface: DevSurface;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/core",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "个人工作台:Agent 工作台外壳(左栏 + 常驻对话 + 自研右侧数据面板)。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -87,7 +87,7 @@
87
87
  "access": "public"
88
88
  },
89
89
  "dependencies": {
90
- "@dsh-workbench/shared": "0.2.11"
90
+ "@dsh-workbench/shared": "0.2.12"
91
91
  },
92
92
  "scripts": {
93
93
  "build": "node scripts/build.mjs && node scripts/build-types.mjs",
@@ -119,4 +119,4 @@
119
119
 
120
120
  - 数据源写在**宿主半侧**,卡片只消费它的返回;
121
121
  - 只读路由出错时回 `{ ok: false, error: { code, message, hint? } }`(HTTP 仍是 200,外壳原样转发);
122
- - 验收时把「正常 / 空 / 出错」三条路都走一遍 —— 真机上造不出来的那几条,写清怎么才能看到(**评审夹具不是必做的**)。
122
+ - 验收时把「正常 / 空 / 出错」三条路都走一遍 —— 真机上造不出来的那几条,写清**怎么才能真看到**(换个空目录、换个不存在的路径那种),别为它写夹具(**2026-10-16 起模板与指引都不带评审夹具**)。
@@ -99,7 +99,7 @@ kit 有上面这几件;手写的会拿到浏览器默认样式,而且**判
99
99
  - **`Stack`** —— 竖排 + 统一间距(懒得分组时的默认容器)。
100
100
  - **`BlockerState`** —— 阻断屏:要登录 / 没权限 / 能力没装好那一类(`blocker` / `t` / `onRetry` / `onOpenMarket`)。
101
101
  - **`Tip`** —— Tooltip:图标钮与只有图的地方**必须**有它(或 `aria-label`)。
102
- - **`MockStrip`** —— 夹具条(`?wbMock=1` 下给自己造那些真机上做不出来的状态)。
102
+ - **别给模块带夹具**:2026-10-16 起模板 / `init` 文案 / 这份指引都不带评审夹具了(`?wbMock=1` 那套、`useFixturePick` / `MockStrip` / `mockNote` 都从模板里删了)。夹具是模块作者负担里最不值的那一份 —— 而**你自己那份 `plugin.test.ts` 就能把五态各喂一遍**,门禁从来只问"空数据画不画得出"(`check:cards`)。外壳自己那套 `?wbMock=1` 夹具是给**外壳的卡片**用的,模块不必跟(机制仍在,谁想要仍然可以用,但**不是你要做的事**)。
103
103
  - **图标** —— `IconPanelScreen`(面板/卡片那类)、`IconModuleMark`(我们的模块类型标)、
104
104
  `IconNpm` / `IconOpencli`(包类型);其余图形一律从 dsh 的 `Icon*Regular` 拿,**别自己画图标**。
105
105
 
@@ -164,7 +164,7 @@ agent 那一侧也要能通过模块自己的能力读到同一份偏好。
164
164
  - **平台没给的那一格就不占位**(不留孤零零的字段名、不留空的一行)。
165
165
  - **读不到就说读不到**,并说清为什么(例:手上这份能力太旧);**绝不显示 0**。
166
166
  - 有确定答案就不打扰他(能按默认读出来就别弹设置面)。
167
- - 真机上造不出来的状态也要画 —— 它在实现时能不能造出来是另一回事(评审夹具,可选)。
167
+ - 真机上造不出来的状态也要**在设计上**画出来(照这一格写清)—— 但**不必为它写夹具**:2026-10-16 起模板与指引都不带评审夹具,模块自己的 `plugin.test.ts` 把五态各喂一遍就够(门禁只问"空数据画不画得出")。
168
168
 
169
169
  ### 7.1 图例就是把屏幕画成 ASCII
170
170
 
@@ -187,7 +187,7 @@ agent 那一侧也要能通过模块自己的能力读到同一份偏好。
187
187
  - **用真字**:图里的文案用界面上真实那句(例「没有指派给你的缺陷。」),别写"一句空态文案"。
188
188
  - **别拿图标代替画面**:给状态起个名字、配个 `⛔` 这类符号,用户还是分不清;一眼能认的是**形状**(整卡换掉 vs 多一行)与**位置**(行首的点、行尾的两颗)。
189
189
  - **画不成的才写词**:动作、agent 的下一步、时间性的"不变 / 自己变",写成词并说清意思。
190
- - **真机上造不出来的状态**:沟通时照样画(画的是设计意图);实现时有 `?wbMock=1` 那一套就顺手造出来给人切 —— **不是必做**。
190
+ - **真机上造不出来的状态**:沟通时照样画(画的是设计意图);实现时**要让它能用真实输入走到**(换个空目录、换个坏路径、先不选),而不是给它写夹具 —— 2026-10-16 起模板与指引都不带评审夹具,模块自己的 `plugin.test.ts` 把五态各喂一遍就够。
191
191
 
192
192
  ## 8 范例(真实产出的形状)
193
193