@dsh-workbench/shared 1.5.4-beta.2 → 1.5.5-beta.0

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 (125) hide show
  1. package/dist/api/workbench-client.d.ts +7 -0
  2. package/dist/components/card/Activity.d.ts +12 -12
  3. package/dist/components/card/Activity.js +0 -12
  4. package/dist/components/card/ApprovalDetail.d.ts +5 -5
  5. package/dist/components/card/ApprovalDetail.js +0 -5
  6. package/dist/components/card/ApprovalPlan.d.ts +4 -4
  7. package/dist/components/card/ApprovalPlan.js +0 -4
  8. package/dist/components/card/Card.d.ts +7 -6
  9. package/dist/components/card/Card.js +0 -6
  10. package/dist/components/card/CardAnchor.d.ts +2 -2
  11. package/dist/components/card/CardAnchor.js +0 -2
  12. package/dist/components/card/CardBoundary.d.ts +6 -6
  13. package/dist/components/card/CardBoundary.js +0 -6
  14. package/dist/components/card/CardHead.d.ts +11 -6
  15. package/dist/components/card/CardHead.js +0 -6
  16. package/dist/components/card/LongTaskRow.d.ts +20 -16
  17. package/dist/components/card/LongTaskRow.js +0 -16
  18. package/dist/components/card/board-module.d.ts +11 -2
  19. package/dist/components/feedback/EmptyIllustration.d.ts +1 -1
  20. package/dist/components/feedback/EmptyIllustration.js +0 -1
  21. package/dist/components/feedback/Note.d.ts +4 -4
  22. package/dist/components/feedback/Note.js +0 -4
  23. package/dist/components/feedback/ResourceStates.d.ts +22 -18
  24. package/dist/components/feedback/ResourceStates.js +0 -10
  25. package/dist/components/feedback/Spinner.d.ts +2 -2
  26. package/dist/components/feedback/Spinner.js +0 -2
  27. package/dist/components/feedback/StateBlock.d.ts +6 -6
  28. package/dist/components/feedback/StateBlock.js +0 -6
  29. package/dist/components/form/ChoiceGroup.d.ts +19 -10
  30. package/dist/components/form/ChoiceGroup.js +0 -8
  31. package/dist/components/form/ConfirmBar.d.ts +7 -7
  32. package/dist/components/form/ConfirmBar.js +0 -7
  33. package/dist/components/form/Field.d.ts +3 -3
  34. package/dist/components/form/Field.js +0 -3
  35. package/dist/components/form/Form.d.ts +0 -8
  36. package/dist/components/form/Form.js +0 -8
  37. package/dist/components/form/FormActions.d.ts +1 -1
  38. package/dist/components/form/FormActions.js +0 -1
  39. package/dist/components/form/FormRows.d.ts +7 -7
  40. package/dist/components/form/FormRows.js +0 -7
  41. package/dist/components/form/FormTypes.d.ts +8 -0
  42. package/dist/components/form/SaveBar.d.ts +5 -5
  43. package/dist/components/form/SaveBar.js +0 -5
  44. package/dist/components/form/SelectField.d.ts +42 -13
  45. package/dist/components/form/SelectField.js +0 -13
  46. package/dist/components/form/TextField.d.ts +1 -1
  47. package/dist/components/form/TextField.js +0 -1
  48. package/dist/components/layout/Link.d.ts +5 -5
  49. package/dist/components/layout/Link.js +0 -5
  50. package/dist/components/layout/Rows.d.ts +3 -3
  51. package/dist/components/layout/Rows.js +0 -3
  52. package/dist/components/layout/SettingsSection.d.ts +4 -4
  53. package/dist/components/layout/SettingsSection.js +0 -4
  54. package/dist/components/layout/SetupShell.d.ts +40 -5
  55. package/dist/components/layout/SetupShell.js +0 -5
  56. package/dist/components/layout/Stack.d.ts +1 -1
  57. package/dist/components/layout/Stack.js +0 -1
  58. package/dist/components/layout/icons.d.ts +1 -9
  59. package/dist/components/layout/icons.js +0 -9
  60. package/dist/contract/command.d.ts +2 -0
  61. package/dist/contract/data.d.ts +10 -0
  62. package/dist/contract/git.d.ts +4 -0
  63. package/dist/contract/lib.d.ts +2 -0
  64. package/dist/contract/module-context.d.ts +3 -0
  65. package/dist/contract/protocol/platform.d.ts +13 -0
  66. package/dist/host/adapters/toolbox-port.d.ts +0 -6
  67. package/dist/host/ai/port.d.ts +5 -0
  68. package/dist/host/ai/types.d.ts +12 -0
  69. package/dist/host/drafts/draft-store.d.ts +5 -0
  70. package/dist/host/runtime/workspace-store.d.ts +2 -0
  71. package/dist/host/seam/intent.d.ts +9 -0
  72. package/dist/host/seam/unit-seam.d.ts +2 -0
  73. package/dist/host/unit/host-kit.d.ts +8 -0
  74. package/dist/host/unit/long-task.d.ts +16 -0
  75. package/dist/host/unit/unit-face.d.ts +20 -0
  76. package/dist/host/unit/value-handoff.d.ts +3 -0
  77. package/package.json +1 -1
  78. package/src/api/workbench-client.ts +7 -0
  79. package/src/components/card/Activity.tsx +12 -12
  80. package/src/components/card/ApprovalDetail.tsx +5 -5
  81. package/src/components/card/ApprovalPlan.tsx +4 -4
  82. package/src/components/card/Card.tsx +7 -6
  83. package/src/components/card/CardAnchor.tsx +2 -2
  84. package/src/components/card/CardBoundary.tsx +6 -6
  85. package/src/components/card/CardHead.tsx +11 -6
  86. package/src/components/card/LongTaskRow.tsx +20 -16
  87. package/src/components/card/board-module.ts +11 -2
  88. package/src/components/feedback/EmptyIllustration.tsx +1 -1
  89. package/src/components/feedback/Note.tsx +4 -4
  90. package/src/components/feedback/ResourceStates.tsx +24 -16
  91. package/src/components/feedback/Spinner.tsx +2 -2
  92. package/src/components/feedback/StateBlock.tsx +6 -6
  93. package/src/components/form/ChoiceGroup.tsx +19 -9
  94. package/src/components/form/ConfirmBar.tsx +7 -7
  95. package/src/components/form/Field.tsx +3 -3
  96. package/src/components/form/Form.tsx +0 -8
  97. package/src/components/form/FormActions.tsx +1 -1
  98. package/src/components/form/FormRows.tsx +7 -7
  99. package/src/components/form/FormTypes.ts +8 -0
  100. package/src/components/form/SaveBar.tsx +5 -5
  101. package/src/components/form/SelectField.tsx +42 -13
  102. package/src/components/form/TextField.tsx +1 -1
  103. package/src/components/layout/Link.tsx +5 -5
  104. package/src/components/layout/Rows.tsx +3 -3
  105. package/src/components/layout/SettingsSection.tsx +4 -4
  106. package/src/components/layout/SetupShell.tsx +40 -5
  107. package/src/components/layout/Stack.tsx +1 -1
  108. package/src/components/layout/icons.tsx +1 -9
  109. package/src/contract/command.ts +2 -0
  110. package/src/contract/data.ts +10 -0
  111. package/src/contract/git.ts +4 -0
  112. package/src/contract/lib.ts +2 -0
  113. package/src/contract/module-context.ts +3 -0
  114. package/src/contract/protocol/platform.ts +13 -0
  115. package/src/host/adapters/toolbox-port.ts +0 -7
  116. package/src/host/ai/port.ts +5 -0
  117. package/src/host/ai/types.ts +12 -0
  118. package/src/host/drafts/draft-store.ts +5 -0
  119. package/src/host/runtime/workspace-store.ts +2 -0
  120. package/src/host/seam/intent.ts +9 -0
  121. package/src/host/seam/unit-seam.ts +2 -0
  122. package/src/host/unit/host-kit.ts +8 -0
  123. package/src/host/unit/long-task.ts +16 -0
  124. package/src/host/unit/unit-face.ts +20 -0
  125. package/src/host/unit/value-handoff.ts +3 -0
@@ -4,19 +4,19 @@ import './Link.css';
4
4
  * `Link` 的契约:目标地址、文案与外链开关。
5
5
  */
6
6
  export interface LinkProps {
7
+ /** 目标地址,必给。 */
7
8
  readonly href: string;
9
+ /** 链接文字(别自己再带 `→`)。 */
8
10
  readonly children?: ReactNode | undefined;
11
+ /** 原生 title 提示;不给就不写这个属性。 */
9
12
  readonly title?: string | undefined;
13
+ /** 默认 true:新窗口打开并画那颗 ↗;站内跳转给 false,箭头也一起不画。 */
10
14
  readonly external?: boolean | undefined;
15
+ /** 追加在基础类名之后,不是替换。 */
11
16
  readonly className?: string | undefined;
12
17
  }
13
18
  /**
14
19
  * 唯一的外链写法:自带新窗口、`rel="noopener noreferrer"`、正文色与行尾那颗小箭头。
15
- * @param props.href - 目标地址,必给。
16
- * @param props.children - 链接文字(别自己再带 `→`)。
17
- * @param props.title - 原生 title 提示;不给就不写这个属性。
18
- * @param props.external - 默认 true:新窗口打开并画那颗 ↗;站内跳转给 false,箭头也一起不画。
19
- * @param props.className - 追加在基础类名之后,不是替换。
20
20
  * @returns 一个 `<a>`。
21
21
  */
22
22
  export declare function Link({ href, children, title, external, className }: LinkProps): JSX.Element;
@@ -3,11 +3,6 @@ import { IconRightUpOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives
3
3
  import './Link.css';
4
4
  /**
5
5
  * 唯一的外链写法:自带新窗口、`rel="noopener noreferrer"`、正文色与行尾那颗小箭头。
6
- * @param props.href - 目标地址,必给。
7
- * @param props.children - 链接文字(别自己再带 `→`)。
8
- * @param props.title - 原生 title 提示;不给就不写这个属性。
9
- * @param props.external - 默认 true:新窗口打开并画那颗 ↗;站内跳转给 false,箭头也一起不画。
10
- * @param props.className - 追加在基础类名之后,不是替换。
11
6
  * @returns 一个 `<a>`。
12
7
  */
13
8
  export function Link({ href, children, title, external = true, className }) {
@@ -4,11 +4,11 @@ import './Rows.css';
4
4
  * `Rows` 的契约:一组键值行的容器。
5
5
  */
6
6
  export interface RowsProps {
7
+ /** 一串 `Row`。 */
7
8
  readonly children?: ReactNode | undefined;
8
9
  }
9
10
  /**
10
11
  * 键值行的容器:分隔线、行距与两端对齐在它和 `Row` 里,别自己写 `ul` / `li` 拼。
11
- * @param props.children - 一串 `Row`。
12
12
  * @returns 竖排的 div。
13
13
  */
14
14
  export declare function Rows({ children }: RowsProps): JSX.Element;
@@ -16,13 +16,13 @@ export declare function Rows({ children }: RowsProps): JSX.Element;
16
16
  * `Row` 的契约:左边名字 + 右边值。
17
17
  */
18
18
  export interface RowProps {
19
+ /** 左边那格(键)。 */
19
20
  readonly label: ReactNode;
21
+ /** 右边那格(值),可以是数字、时间或一小段节点。 */
20
22
  readonly value: ReactNode;
21
23
  }
22
24
  /**
23
25
  * 一行键值:左边名字、右边值;要成对说明一项数据就用它,别自己写两栏。
24
- * @param props.label - 左边那格(键)。
25
- * @param props.value - 右边那格(值),可以是数字、时间或一小段节点。
26
26
  * @returns 一行两格。
27
27
  */
28
28
  export declare function Row({ label, value }: RowProps): JSX.Element;
@@ -2,7 +2,6 @@ import { h } from '../../lib/react.js';
2
2
  import './Rows.css';
3
3
  /**
4
4
  * 键值行的容器:分隔线、行距与两端对齐在它和 `Row` 里,别自己写 `ul` / `li` 拼。
5
- * @param props.children - 一串 `Row`。
6
5
  * @returns 竖排的 div。
7
6
  */
8
7
  export function Rows({ children }) {
@@ -10,8 +9,6 @@ export function Rows({ children }) {
10
9
  }
11
10
  /**
12
11
  * 一行键值:左边名字、右边值;要成对说明一项数据就用它,别自己写两栏。
13
- * @param props.label - 左边那格(键)。
14
- * @param props.value - 右边那格(值),可以是数字、时间或一小段节点。
15
12
  * @returns 一行两格。
16
13
  */
17
14
  export function Row({ label, value }) {
@@ -4,17 +4,17 @@ import './SettingsSection.css';
4
4
  * `SettingsSection` 的契约:一节的读屏名、标题、右上动作与内容。
5
5
  */
6
6
  export interface SettingsSectionProps {
7
+ /** 只给读屏的组名(`aria-label`),不是标题。 */
7
8
  readonly label: string;
9
+ /** 人看的标题。 */
8
10
  readonly title: ReactNode;
11
+ /** 标题右侧的动作(如"添加");不给不占位。 */
9
12
  readonly action?: ReactNode | undefined;
13
+ /** 这一节的内容。 */
10
14
  readonly children?: ReactNode | undefined;
11
15
  }
12
16
  /**
13
17
  * 设置面里的一节:标题 + 右上那颗动作 + 一节内容,把一屏设置分组。
14
- * @param props.label - 只给读屏的组名(`aria-label`),不是标题。
15
- * @param props.title - 人看的标题。
16
- * @param props.action - 标题右侧的动作(如"添加");不给不占位。
17
- * @param props.children - 这一节的内容。
18
18
  * @returns 一个 `role="group"` 的 section。
19
19
  */
20
20
  export declare function SettingsSection({ label, title, action, children }: SettingsSectionProps): JSX.Element;
@@ -2,10 +2,6 @@ import { h } from '../../lib/react.js';
2
2
  import './SettingsSection.css';
3
3
  /**
4
4
  * 设置面里的一节:标题 + 右上那颗动作 + 一节内容,把一屏设置分组。
5
- * @param props.label - 只给读屏的组名(`aria-label`),不是标题。
6
- * @param props.title - 人看的标题。
7
- * @param props.action - 标题右侧的动作(如"添加");不给不占位。
8
- * @param props.children - 这一节的内容。
9
5
  * @returns 一个 `role="group"` 的 section。
10
6
  */
11
7
  export function SettingsSection({ label, title, action, children }) {
@@ -2,28 +2,41 @@ import type { ReactNode } from '../../lib/react.js';
2
2
  /**
3
3
  * 初始化的一步:渲染什么、能不能走、走去哪、走之前存什么。
4
4
  */
5
+ /** 初始化的一步。 */
5
6
  export interface SetupStep {
7
+ /** 步骤 id;`initialStep` / `next` 用它。 */
6
8
  readonly id: string;
9
+ /** 步骤标题。 */
7
10
  readonly title: string;
11
+ /** 画这一步。 */
8
12
  readonly render: (ctx: SetupStepContext) => ReactNode;
13
+ /** 能不能走下一步;不给默认 true。 */
9
14
  readonly canLeave?: ((values: Readonly<Record<string, unknown>>) => boolean) | undefined;
15
+ /** 下一步 id;返回 null 表示没有下一步(走完成)。 */
10
16
  readonly next?: ((values: Readonly<Record<string, unknown>>) => string | null) | undefined;
17
+ /** 这一步单独保存;不给则没有这一步的保存钮。 */
11
18
  readonly submit?: ((values: Readonly<Record<string, unknown>>) => Promise<SetupWriteResult>) | undefined;
12
19
  }
13
20
  /**
14
21
  * 每步的渲染上下文:当前值、改值、忙碌与错误。
15
22
  */
16
23
  export interface SetupStepContext {
24
+ /** 当前值。 */
17
25
  readonly values: Readonly<Record<string, unknown>>;
26
+ /** 改值。 */
18
27
  readonly setValues: (next: Record<string, unknown>) => void;
28
+ /** 正在保存。 */
19
29
  readonly busy: boolean;
30
+ /** 上一条错误;没有是 null。 */
20
31
  readonly error: string | null;
21
32
  }
22
33
  /**
23
34
  * 一次配置读取的结果:`configured` 为真表示已经不用再初始化,`values` 是已存的值。
24
35
  */
25
36
  export interface SetupSnapshot {
37
+ /** 已经配置好,不用再初始化。 */
26
38
  readonly configured: boolean;
39
+ /** 已存的值。 */
27
40
  readonly values?: Readonly<Record<string, unknown>> | undefined;
28
41
  }
29
42
  /**
@@ -43,51 +56,73 @@ export type SetupPhase = 'checking' | 'needs-setup' | 'ready' | 'blocked';
43
56
  /**
44
57
  * `useUnitSetup` 交出来的那台机器;`SetupShell` 只认这一个形状。
45
58
  */
59
+ /** `useUnitSetup` 交出来的状态机。 */
46
60
  export interface UnitSetup {
61
+ /** 现在在哪一相。 */
47
62
  readonly phase: SetupPhase;
63
+ /** 全部步骤。 */
48
64
  readonly steps: readonly SetupStep[];
65
+ /** 当前步骤;相位不是 `needs-setup` 时可能没有。 */
49
66
  readonly step: SetupStep | undefined;
67
+ /** 当前值。 */
50
68
  readonly values: Readonly<Record<string, unknown>>;
69
+ /** 改值。 */
51
70
  readonly setValues: (next: Record<string, unknown>) => void;
71
+ /** 正在保存。 */
52
72
  readonly busy: boolean;
73
+ /** 上一条错误;没有是 null。 */
53
74
  readonly error: string | null;
75
+ /** 当前步能不能走。 */
54
76
  readonly canLeave: boolean;
77
+ /** 能不能回上一步。 */
55
78
  readonly canBack: boolean;
79
+ /** 下一步(先运行当前步的 `submit`)。 */
56
80
  readonly next: () => void;
81
+ /** 回上一步。 */
57
82
  readonly back: () => void;
83
+ /** 重读配置。 */
58
84
  readonly retry: () => void;
85
+ /** `edit` 模式一次存全量;没给 `write` 时无效。 */
59
86
  readonly saveAll: () => void;
60
87
  }
61
88
  /**
62
89
  * `SetupShell` 自己那几句文案;模块按自己的词表给。
63
90
  */
64
91
  export interface SetupShellLabels {
92
+ /** 上一步。 */
65
93
  readonly back: string;
94
+ /** 下一步。 */
66
95
  readonly next: string;
96
+ /** 完成。 */
67
97
  readonly finish: string;
98
+ /** 保存。 */
68
99
  readonly save: string;
100
+ /** 保存中。 */
69
101
  readonly saving: string;
102
+ /** 取消。 */
70
103
  readonly cancel: string;
104
+ /** 正在读。 */
71
105
  readonly reading: string;
106
+ /** 读不到。 */
72
107
  readonly failed: string;
73
108
  }
74
109
  /**
75
110
  * `<SetupShell>` 的 prop:一台 `useUnitSetup` 的机器、文案、以及完成后的主页。
76
111
  */
77
112
  export interface SetupShellProps {
113
+ /** `useUnitSetup` 的返回值;壳不自己取数、不自己写配置。 */
78
114
  readonly setup: UnitSetup;
115
+ /** 八句文案:上一步 / 下一步 / 完成 / 保存 / 保存中 / 取消 / 正在读 / 读不到。 */
79
116
  readonly labels: SetupShellLabels;
117
+ /** `setup`(默认,分步)或 `edit`(同一步骤集合摊成一页,底部 `SaveBar`)。 */
80
118
  readonly mode?: 'setup' | 'edit' | undefined;
119
+ /** 相位到 `ready` 时渲染什么;不给就只留空。 */
81
120
  readonly renderHome?: (() => ReactNode) | undefined;
121
+ /** `edit` 模式点取消做什么;不给钮就什么都不做。 */
82
122
  readonly onCancel?: (() => void) | undefined;
83
123
  }
84
124
  /**
85
125
  * 初始化 / 配置的外壳:分步、上一步 / 下一步 / 完成、阻断与错误,完成之后把主页换进来。
86
- * @param props.setup - `useUnitSetup` 的返回值;壳不自己取数、不自己写配置。
87
- * @param props.labels - 八句文案:上一步 / 下一步 / 完成 / 保存 / 保存中 / 取消 / 正在读 / 读不到。
88
- * @param props.mode - `setup`(默认,分步)或 `edit`(同一步骤集合摊成一页,底部 `SaveBar`)。
89
- * @param props.renderHome - 相位到 `ready` 时渲染什么;不给就只留空。
90
- * @param props.onCancel - `edit` 模式点取消做什么;不给钮就什么都不做。
91
126
  * @returns 一块初始化或配置界面。
92
127
  */
93
128
  export declare function SetupShell({ setup, labels, mode, renderHome, onCancel, }: SetupShellProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null | undefined;
@@ -6,11 +6,6 @@ import { SaveBar } from '../form/SaveBar.js';
6
6
  import styles from './SetupShell.module.css';
7
7
  /**
8
8
  * 初始化 / 配置的外壳:分步、上一步 / 下一步 / 完成、阻断与错误,完成之后把主页换进来。
9
- * @param props.setup - `useUnitSetup` 的返回值;壳不自己取数、不自己写配置。
10
- * @param props.labels - 八句文案:上一步 / 下一步 / 完成 / 保存 / 保存中 / 取消 / 正在读 / 读不到。
11
- * @param props.mode - `setup`(默认,分步)或 `edit`(同一步骤集合摊成一页,底部 `SaveBar`)。
12
- * @param props.renderHome - 相位到 `ready` 时渲染什么;不给就只留空。
13
- * @param props.onCancel - `edit` 模式点取消做什么;不给钮就什么都不做。
14
9
  * @returns 一块初始化或配置界面。
15
10
  */
16
11
  export function SetupShell({ setup, labels, mode = 'setup', renderHome, onCancel, }) {
@@ -4,11 +4,11 @@ import './Stack.css';
4
4
  * `Stack` 的契约:只带一个竖排内容槽。
5
5
  */
6
6
  export interface StackProps {
7
+ /** 要竖排的内容;不给就渲染一个空容器。 */
7
8
  readonly children?: ReactNode | undefined;
8
9
  }
9
10
  /**
10
11
  * 竖排容器:把相邻内容按统一间距摞起来,懒得自己分组时的默认外包装。
11
- * @param props.children - 要竖排的内容;不给就渲染一个空容器。
12
12
  * @returns 竖排的 div。
13
13
  */
14
14
  export declare function Stack({ children }: StackProps): JSX.Element;
@@ -2,7 +2,6 @@ import { h } from '../../lib/react.js';
2
2
  import './Stack.css';
3
3
  /**
4
4
  * 竖排容器:把相邻内容按统一间距摞起来,懒得自己分组时的默认外包装。
5
- * @param props.children - 要竖排的内容;不给就渲染一个空容器。
6
5
  * @returns 竖排的 div。
7
6
  */
8
7
  export function Stack({ children }) {
@@ -2,11 +2,11 @@
2
2
  * 自绘图标的契约:只给边长像素。
3
3
  */
4
4
  export interface IconProps {
5
+ /** 边长像素,同时给 `width` 与 `height`。 */
5
6
  size?: number;
6
7
  }
7
8
  /**
8
9
  * 会话图标:一枚对话气泡,dsh 的图标表里没有,留给我们自己用;默认 16px。
9
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
10
10
  * @returns 一枚 `aria-hidden` 的 svg。
11
11
  */
12
12
  export declare function IconConversation({ size }: IconProps): JSX.Element;
@@ -27,49 +27,41 @@ export declare const BRAND_MARK_COLORS: {
27
27
  };
28
28
  /**
29
29
  * 品牌标:一台显示器,屏幕里放着 dsh 官方的鲸鱼标;默认 24px(它是品牌物,别拿它当通用图标)。
30
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
31
30
  * @returns 一枚 `aria-hidden` 的 svg。
32
31
  */
33
32
  export declare function IconBrandMark({ size }: IconProps): JSX.Element;
34
33
  /**
35
34
  * 品牌标的彩色版:市场里工作台那一行用;颜色写死,不跟主题走。默认 24px。
36
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
37
35
  * @returns 一枚 `aria-hidden` 的 svg。
38
36
  */
39
37
  export declare function IconBrandMarkColor({ size }: IconProps): JSX.Element;
40
38
  /**
41
39
  * opencli 的标:包类型那一格用它;颜色写死的品牌物,不跟主题走。默认 16px。
42
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
43
40
  * @returns 一枚 `aria-hidden` 的 svg。
44
41
  */
45
42
  export declare function IconOpencli({ size }: IconProps): JSX.Element;
46
43
  /**
47
44
  * npm 的标:包类型那一格用它;保留品牌红,不跟主题走。默认 16px。
48
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
49
45
  * @returns 一枚 `aria-hidden` 的 svg。
50
46
  */
51
47
  export declare function IconNpm({ size }: IconProps): JSX.Element;
52
48
  /**
53
49
  * 模块类型标:渐变方块 + 白四宫格,用在"这是个模块"的行首;品牌物,颜色不跟主题走。默认 16px。
54
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
55
50
  * @returns 一枚 `aria-hidden` 的 svg。
56
51
  */
57
52
  export declare function IconModuleMark({ size }: IconProps): JSX.Element;
58
53
  /**
59
54
  * 面板 / 卡片那类的图标:整屏与柱状那种形状,给"面板"这一档用;默认 16px。
60
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
61
55
  * @returns 一枚 `aria-hidden` 的 svg。
62
56
  */
63
57
  export declare function IconPanelScreen({ size }: IconProps): JSX.Element;
64
58
  /**
65
59
  * 命令类型标:一枚终端窗口(第三方图标,配色固定、不跟主题走,出处见 THIRD-PARTY-NOTICES)。默认 16px。
66
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
67
60
  * @returns 一枚 `aria-hidden` 的 svg。
68
61
  */
69
62
  export declare function IconCommand({ size }: IconProps): JSX.Element;
70
63
  /**
71
64
  * 环境变量类型标:一个 ENV 字样的方框;颜色用品牌蓝,不跟主题走。默认 16px。
72
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
73
65
  * @returns 一枚 `aria-hidden` 的 svg。
74
66
  */
75
67
  export declare function IconEnv({ size }: IconProps): JSX.Element;
@@ -4,7 +4,6 @@ function Shell({ size, strokeWidth = 1, viewBox = '0 0 16 16', children, }) {
4
4
  }
5
5
  /**
6
6
  * 会话图标:一枚对话气泡,dsh 的图标表里没有,留给我们自己用;默认 16px。
7
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
8
7
  * @returns 一枚 `aria-hidden` 的 svg。
9
8
  */
10
9
  export function IconConversation({ size = 16 }) {
@@ -32,7 +31,6 @@ export const BRAND_MARK_COLORS = {
32
31
  };
33
32
  /**
34
33
  * 品牌标:一台显示器,屏幕里放着 dsh 官方的鲸鱼标;默认 24px(它是品牌物,别拿它当通用图标)。
35
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
36
34
  * @returns 一枚 `aria-hidden` 的 svg。
37
35
  */
38
36
  export function IconBrandMark({ size = 24 }) {
@@ -44,7 +42,6 @@ export function IconBrandMark({ size = 24 }) {
44
42
  }
45
43
  /**
46
44
  * 品牌标的彩色版:市场里工作台那一行用;颜色写死,不跟主题走。默认 24px。
47
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
48
45
  * @returns 一枚 `aria-hidden` 的 svg。
49
46
  */
50
47
  export function IconBrandMarkColor({ size = 24 }) {
@@ -56,7 +53,6 @@ export function IconBrandMarkColor({ size = 24 }) {
56
53
  }
57
54
  /**
58
55
  * opencli 的标:包类型那一格用它;颜色写死的品牌物,不跟主题走。默认 16px。
59
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
60
56
  * @returns 一枚 `aria-hidden` 的 svg。
61
57
  */
62
58
  export function IconOpencli({ size = 16 }) {
@@ -71,7 +67,6 @@ export function IconOpencli({ size = 16 }) {
71
67
  }
72
68
  /**
73
69
  * npm 的标:包类型那一格用它;保留品牌红,不跟主题走。默认 16px。
74
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
75
70
  * @returns 一枚 `aria-hidden` 的 svg。
76
71
  */
77
72
  export function IconNpm({ size = 16 }) {
@@ -80,7 +75,6 @@ export function IconNpm({ size = 16 }) {
80
75
  }
81
76
  /**
82
77
  * 模块类型标:渐变方块 + 白四宫格,用在"这是个模块"的行首;品牌物,颜色不跟主题走。默认 16px。
83
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
84
78
  * @returns 一枚 `aria-hidden` 的 svg。
85
79
  */
86
80
  export function IconModuleMark({ size = 16 }) {
@@ -98,7 +92,6 @@ export function IconModuleMark({ size = 16 }) {
98
92
  }
99
93
  /**
100
94
  * 面板 / 卡片那类的图标:整屏与柱状那种形状,给"面板"这一档用;默认 16px。
101
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
102
95
  * @returns 一枚 `aria-hidden` 的 svg。
103
96
  */
104
97
  export function IconPanelScreen({ size = 16 }) {
@@ -107,7 +100,6 @@ export function IconPanelScreen({ size = 16 }) {
107
100
  }
108
101
  /**
109
102
  * 命令类型标:一枚终端窗口(第三方图标,配色固定、不跟主题走,出处见 THIRD-PARTY-NOTICES)。默认 16px。
110
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
111
103
  * @returns 一枚 `aria-hidden` 的 svg。
112
104
  */
113
105
  export function IconCommand({ size = 16 }) {
@@ -127,7 +119,6 @@ export function IconCommand({ size = 16 }) {
127
119
  }
128
120
  /**
129
121
  * 环境变量类型标:一个 ENV 字样的方框;颜色用品牌蓝,不跟主题走。默认 16px。
130
- * @param props.size - 边长像素,同时给 `width` 与 `height`。
131
122
  * @returns 一枚 `aria-hidden` 的 svg。
132
123
  */
133
124
  export function IconEnv({ size = 16 }) {
@@ -19,7 +19,9 @@ export interface CommandResult {
19
19
  readonly filePaths: readonly string[];
20
20
  readonly error?: string | undefined;
21
21
  }
22
+ /** 运行一条 argv 命令,不经过 shell。 */
22
23
  export interface CommandReader {
24
+ /** files 先写成临时文件,按 appendFileArgs 追加到 argv,运行完清掉。 */
23
25
  run(request: CommandRequest): Promise<CommandResult>;
24
26
  }
25
27
  export declare const INSTALL_FAILURE_KINDS: readonly ["permission", "disk-full", "auth", "sandbox", "unknown"];
@@ -1,8 +1,11 @@
1
1
  export interface DataRequestBase {
2
2
  readonly timeoutMs?: number;
3
3
  }
4
+ /** 每次读 / 写调用的通用选项。 */
4
5
  export interface DataCallOptions {
6
+ /** 取消这次调用。 */
5
7
  readonly signal?: AbortSignal | undefined;
8
+ /** 浏览器读时是否打开窗口;不给沿用请求里的 open。 */
6
9
  readonly open?: boolean | undefined;
7
10
  }
8
11
  export interface HttpDataRequest extends DataRequestBase {
@@ -197,12 +200,19 @@ export interface SubmitPlanOptions extends DataCallOptions {
197
200
  readonly confirm: (step: PlanStep, index: number) => boolean | Promise<boolean>;
198
201
  readonly onStep?: ((step: PlanStep, index: number, result: PlanStepResult<unknown>) => void) | undefined;
199
202
  }
203
+ /** 站点数据读取:按请求 / 配方 / 计划读,写只走 submit / submitPlan。 */
200
204
  export interface DataReader {
205
+ /** 直接执行一条 DataRequest。 */
201
206
  read<T = unknown>(request: DataRequest, options?: DataCallOptions): Promise<DataResult<T>>;
207
+ /** 按配方读一条;overrides 盖配方里的变量。 */
202
208
  request<T = unknown>(recipe: RequestRecipe, overrides?: CallOverrides, options?: DataCallOptions): Promise<DataResult<T>>;
209
+ /** 同一配方多条调用一起读;只读 GET,写仍走 submit。 */
203
210
  requestMany<T = unknown>(recipe: RequestRecipe, calls: RecipeCalls, options?: DataCallOptions): Promise<RecipeResults<T>>;
211
+ /** 跑一个只读计划。 */
204
212
  plan(plan: RequestPlan, options?: DataCallOptions): Promise<PlanResults>;
213
+ /** 跑写计划;confirm 返回 false 就停,idempotencyKey 防重复。 */
205
214
  submitPlan(plan: RequestPlan, options: SubmitPlanOptions): Promise<PlanResults>;
215
+ /** 按配方写一条。 */
206
216
  submit<T = unknown>(recipe: RequestRecipe, overrides?: CallOverrides, options?: DataCallOptions): Promise<DataResult<T>>;
207
217
  }
208
218
  export interface BrowserCaptureRow {
@@ -31,8 +31,12 @@ export type HeadRead = {
31
31
  readonly reason: string;
32
32
  readonly detail?: string;
33
33
  };
34
+ /** 只读 git 信息,不执行任意 git 命令。 */
34
35
  export interface GitReader {
36
+ /** 读 path 的 origin remote;没有回 no-origin,读不了回 unknown。 */
35
37
  origin(path: string): Promise<OriginRead>;
38
+ /** 读当前分支;detached HEAD 回 no-branch。 */
36
39
  branch(path: string): Promise<BranchRead>;
40
+ /** 读当前 commit;没有提交回 no-head。 */
37
41
  head(path: string): Promise<HeadRead>;
38
42
  }
@@ -1,4 +1,6 @@
1
1
  import type { LibNeed } from './needs.js';
2
+ /** 从共用依赖里加载模块。 */
2
3
  export interface LibReader {
4
+ /** 按 need 找已安装版本,加载 entry 指向的模块。 */
3
5
  load<T = unknown>(need: LibNeed, entry: string): Promise<T>;
4
6
  }
@@ -2,8 +2,11 @@
2
2
  * 模块拿得到的上下文:只承诺 `get` / `effect` / `logger`,不把 dsh 的 cordis Context 整棵交出去。
3
3
  */
4
4
  export interface HostContext {
5
+ /** 按名字取注入的服务;名字要写在清单的 host.inject 里,没注入时 undefined。 */
5
6
  get<T = unknown>(name: string): T | undefined;
7
+ /** 登记一个随本单元卸载的副作用;回调返回的函数在卸载时跑,label 只用于日志。 */
6
8
  effect(effect: () => void | (() => void), label?: string): unknown;
9
+ /** 工作台日志口;没有就不记。 */
7
10
  readonly logger?: {
8
11
  info?(message: string): void;
9
12
  warn?(message: string): void;
@@ -25,13 +25,21 @@ export interface ToolchainPlan {
25
25
  readonly expectedMajor: 10;
26
26
  };
27
27
  }
28
+ /** 工作台平台信息:部署形态、系统、运行时、profile、能力、重启提示、工具链。 */
28
29
  export interface HostSurface {
30
+ /** 'web' 是浏览器里跑,'desktop' 是桌面壳。 */
29
31
  readonly deployment: Deployment;
32
+ /** 工作台所在的操作系统;认不出是 'other'。 */
30
33
  readonly hostOs: HostOs;
34
+ /** 工作台运行在 Electron 还是 Node 里。 */
31
35
  readonly runtime: HostRuntime;
36
+ /** 当前 dsh profile;独立实例是它自己的那个。 */
32
37
  readonly profile: ProfileName;
38
+ /** 这份工作台有哪些能力:页面调试 / 站点探索 / 录制 / 浏览器唤醒 / 自更新 / 安全模式 / 文件管理器。 */
33
39
  readonly capabilities: HostCapabilities;
40
+ /** 要重启时给用户看的那句话。 */
34
41
  readonly restartHint: string;
42
+ /** 工具链计划:node 从哪来、npm/pnpm 什么时候需要。 */
35
43
  readonly toolchain: ToolchainPlan;
36
44
  }
37
45
  export interface ClientCapabilities {
@@ -39,9 +47,14 @@ export interface ClientCapabilities {
39
47
  readonly macFileManager: boolean;
40
48
  readonly primaryModifier: 'meta' | 'ctrl';
41
49
  }
50
+ /** 浏览器侧平台事实。 */
42
51
  export interface ClientSurface {
52
+ /** 'web' 是浏览器里跑,'desktop' 是桌面壳。 */
43
53
  readonly deployment: Deployment;
54
+ /** 'electron' 桌面壳 / 'browser' 浏览器。 */
44
55
  readonly shell: ClientShell;
56
+ /** 工作台所在的操作系统;认不出是 'other'。 */
45
57
  readonly hostOs: HostOs;
58
+ /** 浏览器侧能力:调试页脚 / 访达 / 主修饰键。 */
46
59
  readonly capabilities: ClientCapabilities;
47
60
  }
@@ -1,11 +1,5 @@
1
- export interface ToolboxCapability {
2
- readonly name: string;
3
- readonly description: string;
4
- readonly content: string;
5
- }
6
1
  export interface ToolboxPort {
7
2
  packsOf(session: string | null, preset: string | null): ReadonlySet<string>;
8
- capabilityBrief?(workspace: string | null): ToolboxCapability;
9
3
  }
10
4
  export interface McpServerPacks {
11
5
  readonly name: string;
@@ -2,13 +2,18 @@ import type { AiAdapter } from './adapter.js';
2
2
  import { type AgentOptions, type AiCapability, type AiRequest, type AiResult, type JsonSchema } from './types.js';
3
3
  /** 这层的版本号:只增。 */
4
4
  export declare const AI_VERSION = 1;
5
+ /** 模块用的模型入口:ask / askJson / askRich / agent。 */
5
6
  export interface AiPort {
6
7
  readonly version: number;
8
+ /** 只回文本;除 prompt 外全部可选。 */
7
9
  ask(request: AiRequest): Promise<string>;
10
+ /** 保证返回对象:schema 附在提示词后,不合格自动重试一次,仍不合格抛 schema-mismatch。 */
8
11
  askJson<T>(request: AiRequest & {
9
12
  readonly schema: JsonSchema;
10
13
  }): Promise<T>;
14
+ /** 同 ask,另回 usage / model / elapsedMs。 */
11
15
  askRich(request: AiRequest): Promise<AiResult>;
16
+ /** 起子 agent(可带工具);比 ask 贵,能用 ask 就不用。 */
12
17
  agent(request: AiRequest & {
13
18
  readonly agent?: AgentOptions;
14
19
  }): Promise<string>;
@@ -14,21 +14,33 @@ export type ImageLike = string | Uint8Array | {
14
14
  /** 留给将来的非图片附件(PDF、音频);现在只有占位,实现了才算数。 */
15
15
  export type AttachmentLike = never;
16
16
  /** 一次调用要的东西;除 `prompt` 外都可选,所以加字段永远不算破坏性变更。 */
17
+ /** 一次模型调用:除 prompt 外全部可选。 */
17
18
  export interface AiRequest {
19
+ /** 要模型做什么。 */
18
20
  readonly prompt: string;
21
+ /** 图片:绝对路径 / data URL / Uint8Array;不要自己拼内容块。 */
19
22
  readonly images?: readonly ImageLike[] | undefined;
20
23
  readonly attachments?: readonly AttachmentLike[] | undefined;
24
+ /** 给 askJson 用;会附在提示词后并校验。 */
21
25
  readonly schema?: JsonSchema | undefined;
26
+ /** 取消信号;长任务停止时 abort。 */
22
27
  readonly signal?: AbortSignal | undefined;
28
+ /** 进度回调:结构化输出不合格、准备重试时给一句。 */
23
29
  readonly onStep?: ((text: string) => void) | undefined;
30
+ /** 流式增量回调;只有适配器支持时才有。 */
24
31
  readonly onDelta?: ((chunk: string) => void) | undefined;
32
+ /** 覆盖默认模型:provider / model 都可只给一个。 */
25
33
  readonly model?: {
26
34
  readonly provider?: string;
27
35
  readonly model?: string;
28
36
  } | undefined;
37
+ /** 采样温度;不给用模型默认。 */
29
38
  readonly temperature?: number | undefined;
39
+ /** 结构化输出不合格时最多再试几次;默认 1(共两次)。 */
30
40
  readonly retry?: number | undefined;
41
+ /** 本次调用超时;到点中止。 */
31
42
  readonly timeoutMs?: number | undefined;
43
+ /** schema 校验时把不认识的关键字也算问题。 */
32
44
  readonly strict?: boolean | undefined;
33
45
  }
34
46
  /** 直接交给 agent 的一个工具:描述加实现,只在这次调用里有效。 */
@@ -36,13 +36,18 @@ export interface DraftLookup {
36
36
  readonly id: string;
37
37
  readonly session?: string | undefined;
38
38
  }
39
+ /** 会话草稿库:正文落在临时目录,按会话隔离,只认自己发出的 id。 */
39
40
  export interface DraftStore {
41
+ /** 存一份草稿,返回 id / 路径 / 字节数 / sha256;超过上限或不是文本会回 ok:false。 */
40
42
  put(input: DraftPutInput): DraftPutResult;
43
+ /** 按 id 读回正文;带了 session 就还要对得上。 */
41
44
  content(input: DraftLookup): DraftContentResult;
45
+ /** 按 id + session 取写入路径。 */
42
46
  pathOf(input: {
43
47
  readonly id: string;
44
48
  readonly session: string;
45
49
  }): DraftPathResult;
50
+ /** 关掉草稿库;之后的 put / content / pathOf 都失效。 */
46
51
  dispose(): void;
47
52
  }
48
53
  /**
@@ -6,7 +6,9 @@ export interface ModuleStore {
6
6
  remove(name: string): void;
7
7
  list(): string[];
8
8
  }
9
+ /** 按工作区隔离的模块存储。 */
9
10
  export interface WorkspaceStore {
11
+ /** 取单元 + 工作区的存储;workspace 为 null 或空串时是进程内存储(重启就丢)。 */
10
12
  for(unitId: string, workspace: string | null): ModuleStore;
11
13
  machine(unitId: string): ModuleStore;
12
14
  scan(unitId: string): ModuleStore[];
@@ -50,14 +50,23 @@ export declare class SeamError extends Error {
50
50
  });
51
51
  }
52
52
  export type UnitWriteScope = 'unit' | 'workspace';
53
+ /** 一次 run 的参数:命令、写到哪、失败怎么办。 */
53
54
  export interface UnitSeamRequest {
55
+ /** 要执行的 shell 命令。 */
54
56
  readonly command: string;
57
+ /** 'unit' 写单元自己的数据根(不用审批);'workspace' 写当前工作区,要声明并带会话。 */
55
58
  readonly scope: UnitWriteScope;
59
+ /** 命令在哪个目录跑;不给用执行缝的默认目录。 */
56
60
  readonly workdir?: string | undefined;
61
+ /** 超时毫秒;不给就不加额外超时。 */
57
62
  readonly timeoutMs?: number | undefined;
63
+ /** 额外环境变量;会盖在工作台注入的 HOME / 缓存之上。 */
58
64
  readonly env?: Readonly<Record<string, string>> | undefined;
65
+ /** 写工作区时必须给:工具里传 exec;路由/动作没有会话,不能请求 workspace。 */
59
66
  readonly session?: unknown;
67
+ /** 取消信号;有人按停时 abort。 */
60
68
  readonly signal?: AbortSignal | undefined;
69
+ /** 'safe' 只给幂等 / 只读命令,失败时可安全重试;默认 'never'。 */
61
70
  readonly retry?: 'safe' | 'never' | undefined;
62
71
  }
63
72
  export declare function productWrite(): WriteIntent;