@dsh-workbench/core 0.3.11 → 1.0.0-beta.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 (224) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -117
  3. package/bin/dsh-workbench +130 -29
  4. package/bin/dsh-workbench.cmd +5 -0
  5. package/bin/opencli-isolated +3 -2
  6. package/bin/opencli-isolated.mjs +44 -0
  7. package/bin/opencli-node-mode.cjs +1 -0
  8. package/bin/seed-workshop-windows.mjs +307 -0
  9. package/client.js +4632 -2002
  10. package/cordis.patch.yml +3 -3
  11. package/dist/client/client.body.js +4632 -2002
  12. package/dist/client/index.js +5306 -2676
  13. package/dist/host/index.js +6990 -5879
  14. package/dist/types/app/client.d.ts +1 -0
  15. package/dist/types/app/host.d.ts +2 -1
  16. package/dist/types/app/layouts/approval-detail.d.ts +3 -0
  17. package/dist/types/app/layouts/env-gate/boot-gate.d.ts +1 -12
  18. package/dist/types/app/layouts/env-gate/gate-text.d.ts +2 -1
  19. package/dist/types/app/layouts/market/DiscoverPanel.d.ts +8 -0
  20. package/dist/types/app/layouts/market/add-module-text.d.ts +1 -1
  21. package/dist/types/app/layouts/market/discover-categories.d.ts +8 -0
  22. package/dist/types/app/layouts/market/discover-confirm.d.ts +14 -0
  23. package/dist/types/app/layouts/market/discover-detail.d.ts +12 -0
  24. package/dist/types/app/layouts/market/discover-dialogs.d.ts +7 -0
  25. package/dist/types/app/layouts/market/discover-doc.d.ts +18 -0
  26. package/dist/types/app/layouts/market/discover-init-dialog.d.ts +10 -0
  27. package/dist/types/app/layouts/market/discover-rows.d.ts +24 -0
  28. package/dist/types/app/layouts/market/discover-sources-dialog.d.ts +17 -0
  29. package/dist/types/app/layouts/market/discover-states.d.ts +22 -0
  30. package/dist/types/app/layouts/market/discover-toolbar.d.ts +23 -0
  31. package/dist/types/app/layouts/market/discover-versions.d.ts +9 -0
  32. package/dist/types/app/layouts/market/discover-view.d.ts +38 -0
  33. package/dist/types/app/layouts/market/market-header.d.ts +13 -0
  34. package/dist/types/app/layouts/market/panel.d.ts +1 -1
  35. package/dist/types/app/layouts/market/use-add-module.d.ts +1 -1
  36. package/dist/types/app/layouts/market/use-discover.d.ts +73 -0
  37. package/dist/types/app/layouts/market/use-module-versions.d.ts +1 -8
  38. package/dist/types/app/layouts/rightbar/MarketView.d.ts +1 -1
  39. package/dist/types/app/layouts/rightbar/Rightbar.d.ts +1 -1
  40. package/dist/types/app/layouts/rightbar/board-shape.d.ts +1 -14
  41. package/dist/types/app/layouts/rightbar/market-busy.d.ts +0 -22
  42. package/dist/types/app/layouts/rightbar/market-change.d.ts +1 -1
  43. package/dist/types/app/layouts/rightbar/market-hint.d.ts +1 -7
  44. package/dist/types/app/layouts/rightbar/market-plugin-rows.d.ts +0 -7
  45. package/dist/types/app/layouts/rightbar/market-row-icon.d.ts +1 -1
  46. package/dist/types/app/layouts/rightbar/market-row-types.d.ts +2 -2
  47. package/dist/types/app/layouts/rightbar/market-rows.d.ts +1 -1
  48. package/dist/types/app/layouts/rightbar/market-section-icon.d.ts +1 -1
  49. package/dist/types/app/layouts/rightbar/market-settle-hold.d.ts +1 -1
  50. package/dist/types/app/layouts/rightbar/market-settle.d.ts +4 -7
  51. package/dist/types/app/layouts/rightbar/market-shared-rows.d.ts +1 -1
  52. package/dist/types/app/layouts/rightbar/market-update-verdict.d.ts +1 -11
  53. package/dist/types/app/layouts/rightbar/market-view-text.d.ts +5 -1
  54. package/dist/types/app/layouts/rightbar/market-workbench-row.d.ts +1 -1
  55. package/dist/types/app/layouts/rightbar/store.d.ts +0 -12
  56. package/dist/types/app/layouts/sidebar/LongTaskDot.d.ts +0 -6
  57. package/dist/types/app/layouts/sidebar/LongTaskHover.d.ts +0 -6
  58. package/dist/types/app/layouts/sidebar/edition-boot.d.ts +1 -19
  59. package/dist/types/app/layouts/sidebar/edition.d.ts +1 -18
  60. package/dist/types/app/layouts/sidebar/use-attention.d.ts +0 -4
  61. package/dist/types/app/layouts/sidebar/workshop-preset.d.ts +2 -0
  62. package/dist/types/app/layouts/workbench-settings/AdapterSetItem.d.ts +5 -0
  63. package/dist/types/app/layouts/workbench-settings/ConfigSyncRows.d.ts +11 -0
  64. package/dist/types/app/layouts/workbench-settings/NewWorkbenchItem.d.ts +5 -0
  65. package/dist/types/app/layouts/workbench-settings/SettingsItem.d.ts +0 -9
  66. package/dist/types/app/layouts/workbench-settings/SidebarEditionItem.d.ts +0 -6
  67. package/dist/types/app/layouts/workbench-settings/WorkbenchSettingsSection.d.ts +0 -6
  68. package/dist/types/app/units/manifests.d.ts +1 -1
  69. package/dist/types/{app/units → kernel/client}/registry.d.ts +1 -1
  70. package/dist/types/kernel/contract/bundle-install.d.ts +2 -0
  71. package/dist/types/kernel/contract/config-sync.d.ts +2 -0
  72. package/dist/types/kernel/contract/diy.d.ts +1 -0
  73. package/dist/types/kernel/contract/dsh-plugins.d.ts +2 -0
  74. package/dist/types/kernel/contract/index.d.ts +5 -0
  75. package/dist/types/kernel/contract/long-tasks.d.ts +2 -0
  76. package/dist/types/kernel/contract/market-index.d.ts +2 -0
  77. package/dist/types/kernel/contract/platform.d.ts +1 -0
  78. package/dist/types/kernel/contract/preflight-wake.d.ts +2 -0
  79. package/dist/types/kernel/contract/profile-create.d.ts +2 -0
  80. package/dist/types/kernel/contract/sidebar-edition.d.ts +2 -0
  81. package/dist/types/kernel/contract/unit-manifests.d.ts +2 -0
  82. package/dist/types/{shared/api → kernel}/host/mount-units.d.ts +5 -1
  83. package/dist/types/modules/panels/client.d.ts +1 -1
  84. package/dist/types/modules/panels/model/approval.d.ts +3 -15
  85. package/dist/types/modules/panels/model/diy-changelog.d.ts +2 -0
  86. package/dist/types/modules/panels/model/diy-context.d.ts +1 -16
  87. package/dist/types/modules/panels/model/diy-page.d.ts +1 -0
  88. package/dist/types/modules/panels/model/diy-record-open.d.ts +0 -15
  89. package/dist/types/modules/panels/model/diy-record-text.d.ts +0 -2
  90. package/dist/types/modules/panels/model/diy-record.d.ts +0 -30
  91. package/dist/types/modules/panels/model/diy-tools.d.ts +1 -0
  92. package/dist/types/modules/panels/model/long-task-tools.d.ts +0 -11
  93. package/dist/types/modules/panels/model/market-dependency-update.d.ts +1 -7
  94. package/dist/types/modules/panels/model/market-dependency.d.ts +15 -10
  95. package/dist/types/modules/panels/model/market-discover-routes.d.ts +3 -0
  96. package/dist/types/modules/panels/model/market-discover.d.ts +33 -0
  97. package/dist/types/modules/panels/model/market-dispatch.d.ts +3 -3
  98. package/dist/types/modules/panels/model/market-env.d.ts +2 -3
  99. package/dist/types/modules/panels/model/market-registry.d.ts +3 -3
  100. package/dist/types/modules/panels/model/market-restart.d.ts +1 -1
  101. package/dist/types/modules/panels/model/market-route.d.ts +5 -3
  102. package/dist/types/modules/panels/model/market-sources-act.d.ts +9 -0
  103. package/dist/types/modules/panels/model/market-types.d.ts +6 -13
  104. package/dist/types/modules/panels/model/market-update-bundle.d.ts +3 -9
  105. package/dist/types/modules/panels/model/market-verify.d.ts +3 -19
  106. package/dist/types/modules/panels/model/market-workbench-update.d.ts +3 -2
  107. package/dist/types/modules/panels/model/market.d.ts +6 -5
  108. package/dist/types/modules/panels/model/plugin-actions.d.ts +2 -1
  109. package/dist/types/modules/panels/model/plugin-section.d.ts +3 -1
  110. package/dist/types/modules/panels/model/publish-preview-routes.d.ts +2 -0
  111. package/dist/types/modules/panels/unit.d.ts +7 -3
  112. package/dist/types/modules/sessions/model/attention.d.ts +0 -11
  113. package/dist/types/modules/sessions/model/session-node.d.ts +0 -10
  114. package/dist/types/shared/api/diy.d.ts +6 -4
  115. package/dist/types/shared/api/host/approval-call.d.ts +0 -9
  116. package/dist/types/shared/api/host/approval-gate.d.ts +0 -13
  117. package/dist/types/shared/api/host/bundle-routes.d.ts +1 -1
  118. package/dist/types/shared/api/host/diy-artifacts.d.ts +0 -11
  119. package/dist/types/shared/api/host/diy-changelog.d.ts +13 -0
  120. package/dist/types/shared/api/host/diy-components.d.ts +2 -3
  121. package/dist/types/shared/api/host/diy-modules.d.ts +0 -16
  122. package/dist/types/shared/api/host/diy-publish-preview.d.ts +4 -0
  123. package/dist/types/shared/api/host/diy-recon-fs.d.ts +2 -2
  124. package/dist/types/shared/api/host/diy-tokens.d.ts +8 -0
  125. package/dist/types/shared/api/host/host-routes.d.ts +3 -6
  126. package/dist/types/shared/api/host/long-task-notice.d.ts +0 -20
  127. package/dist/types/shared/api/host/long-tasks.d.ts +1 -8
  128. package/dist/types/shared/api/host/market-doc.d.ts +21 -0
  129. package/dist/types/shared/api/host/market-index-fetch.d.ts +37 -0
  130. package/dist/types/shared/api/host/market-source-init.d.ts +22 -0
  131. package/dist/types/shared/api/host/market-sources-store.d.ts +15 -0
  132. package/dist/types/shared/api/host/permission-mode.d.ts +0 -5
  133. package/dist/types/shared/api/host/post-channels.d.ts +1 -1
  134. package/dist/types/shared/api/host/sidebar-edition.d.ts +1 -33
  135. package/dist/types/shared/api/host/unit-roster-facts.d.ts +1 -1
  136. package/dist/types/shared/api/host/workspace-root.d.ts +0 -7
  137. package/dist/types/shared/api/platform/client.d.ts +10 -0
  138. package/dist/types/shared/api/unit-board.d.ts +0 -16
  139. package/dist/types/shared/api/write-outcome.d.ts +0 -12
  140. package/dist/types/shared/components/IconModules.d.ts +0 -6
  141. package/dist/types/shared/components/PanelFoot.d.ts +0 -9
  142. package/dist/types/shared/components/blocker-action.d.ts +0 -13
  143. package/dist/types/shared/dev-surface/index.d.ts +5 -0
  144. package/dist/types/shared/dev-surface/types.d.ts +79 -0
  145. package/dist/types/shared/hooks/bundle-queries.d.ts +1 -13
  146. package/dist/types/shared/hooks/fact-transport.d.ts +4 -0
  147. package/dist/types/shared/hooks/fact-transports.d.ts +0 -4
  148. package/dist/types/shared/hooks/market-queries.d.ts +11 -0
  149. package/dist/types/shared/hooks/panel-state-report.d.ts +0 -12
  150. package/dist/types/shared/hooks/sidebar-edition.d.ts +1 -6
  151. package/dist/types/shared/hooks/use-blocker-actions.d.ts +0 -8
  152. package/dist/types/shared/hooks/use-capabilities.d.ts +0 -59
  153. package/dist/types/shared/hooks/use-diy-debug.d.ts +0 -13
  154. package/dist/types/shared/hooks/use-diy-record.d.ts +0 -13
  155. package/dist/types/shared/hooks/use-shell-long-tasks.d.ts +1 -7
  156. package/icon.svg +17 -28
  157. package/package.json +33 -13
  158. package/preset/diy.patch.yml +1 -1
  159. package/profile/isolation.patch.yml +8 -8
  160. package/profile/sandbox.patch.yml +2 -2
  161. package/scripts/clone-profile.mjs +268 -0
  162. package/scripts/create-workbench.mjs +166 -0
  163. package/scripts/seed-profile.sh +22 -10
  164. package/scripts/seed-workshop.sh +17 -19
  165. package/skills/workbench-module-diy/BUILD.md +4 -11
  166. package/skills/workbench-module-diy/COPY.md +1 -1
  167. package/skills/workbench-module-diy/DATASOURCE.md +107 -22
  168. package/skills/workbench-module-diy/DESIGN.md +2 -1
  169. package/skills/workbench-module-diy/FAMILY.md +48 -68
  170. package/skills/workbench-module-diy/KIT.md +6 -3
  171. package/skills/workbench-module-diy/LINKAGE.md +1 -1
  172. package/skills/workbench-module-diy/PANEL.md +5 -3
  173. package/skills/workbench-module-diy/REVIEW.md +7 -7
  174. package/skills/workbench-module-diy/SKILL.md +20 -11
  175. package/skills/workbench-module-diy/STEPS.md +1 -1
  176. package/skills/workbench-module-diy/TOOLS.md +33 -9
  177. package/skills/workbench-module-diy/WIRING.md +18 -6
  178. package/skills/workbench-module-diy/WRITES.md +30 -4
  179. package/dist/types/shared/api/bundle-install.d.ts +0 -136
  180. package/dist/types/shared/api/config-sync.d.ts +0 -35
  181. package/dist/types/shared/api/dsh-plugins.d.ts +0 -11
  182. package/dist/types/shared/api/host/bundle-manager.d.ts +0 -11
  183. package/dist/types/shared/api/host/config-sync.d.ts +0 -46
  184. package/dist/types/shared/api/host/diy-preset-health.d.ts +0 -35
  185. package/dist/types/shared/api/host/dsh-plugins.d.ts +0 -5
  186. package/dist/types/shared/api/host/installed-module.d.ts +0 -54
  187. package/dist/types/shared/api/host/installed-module.test.d.ts +0 -1
  188. package/dist/types/shared/api/host/opencli-command.d.ts +0 -10
  189. package/dist/types/shared/api/host/opencli-command.test.d.ts +0 -1
  190. package/dist/types/shared/api/host/opencli.test.d.ts +0 -1
  191. package/dist/types/shared/api/host/package-content.d.ts +0 -6
  192. package/dist/types/shared/api/host/package-content.test.d.ts +0 -1
  193. package/dist/types/shared/api/host/package-kind.d.ts +0 -21
  194. package/dist/types/shared/api/host/package-kind.test.d.ts +0 -1
  195. package/dist/types/shared/api/host/package-route.d.ts +0 -23
  196. package/dist/types/shared/api/host/package-route.test.d.ts +0 -1
  197. package/dist/types/shared/api/host/plugin-catalog.d.ts +0 -65
  198. package/dist/types/shared/api/host/plugin-login-hint.d.ts +0 -2
  199. package/dist/types/shared/api/host/plugin-tools.d.ts +0 -14
  200. package/dist/types/shared/api/host/plugin-units.d.ts +0 -48
  201. package/dist/types/shared/api/host/preflight-route.d.ts +0 -15
  202. package/dist/types/shared/api/host/preflight.d.ts +0 -75
  203. package/dist/types/shared/api/host/probe-cache.d.ts +0 -6
  204. package/dist/types/shared/api/host/probe-libs.d.ts +0 -11
  205. package/dist/types/shared/api/host/probe-units.d.ts +0 -17
  206. package/dist/types/shared/api/host/probe-verdict.d.ts +0 -7
  207. package/dist/types/shared/api/host/profile-registries.d.ts +0 -21
  208. package/dist/types/shared/api/host/registry-declaration.d.ts +0 -23
  209. package/dist/types/shared/api/host/release.d.ts +0 -24
  210. package/dist/types/shared/api/host/runtime-seed.d.ts +0 -40
  211. package/dist/types/shared/api/host/self-update.d.ts +0 -52
  212. package/dist/types/shared/api/host/version-range.d.ts +0 -2
  213. package/dist/types/shared/api/long-tasks.d.ts +0 -19
  214. package/dist/types/shared/api/sidebar-edition.d.ts +0 -14
  215. package/dist/types/shared/api/unit-manifests.d.ts +0 -6
  216. package/docs/HANDOFF.md +0 -333
  217. package/docs/OPERATIONS.md +0 -240
  218. package/skills/workbench-module-diy/TOOLING.md +0 -38
  219. /package/dist/types/{app/layouts/rightbar/registry.d.ts → kernel/client/board-registry.d.ts} +0 -0
  220. /package/dist/types/{app/layouts/rightbar/registry.test.d.ts → kernel/contract/contracts.test.d.ts} +0 -0
  221. /package/dist/types/{shared/api/host/bundle-manager.test.d.ts → kernel/contract/index.test.d.ts} +0 -0
  222. /package/dist/types/{shared/api → kernel}/host/unit-readiness.d.ts +0 -0
  223. /package/dist/types/{shared/api → kernel}/host/unit-registry.d.ts +0 -0
  224. /package/dist/types/shared/{api/host/dsh-plugins.test.d.ts → dev-surface/install.d.ts} +0 -0
@@ -5,18 +5,18 @@
5
5
  | 判据 | 检查 | 修法 |
6
6
  |---|---|---|
7
7
  | `contracts` | 清单 ↔ 代码 ↔ `design.json` 漂移;dsh 组合期不校验清单 | 按报错改:`unit` 重名换名;`dsh.workbenchFaces` 两个源码入口;六个脚本;`private: true`。`dsh.workbench.tools` 与 `registerTools()` 一致;`design.json` 对键名;生成物过期跑 `sync` |
8
- | `protocol` | `dsh.workbench` 版本 / 形状 / 多余键(外壳静默忽略生字段) | 补 `"apiVersion": 1`;`unit` / `card` / `tools` / `host` 写全(无卡片 `null`、无工具 `[]`);删协议外键(`faces` 在 `dsh.workbenchFaces`;不写 `scope`) |
8
+ | `protocol` | `dsh.workbench` 版本 / 形状 / 多余键(外壳静默忽略生字段) | 补 `"apiVersion": 2`;`unit` / `card` / `tools` / `host` 写全(无卡片 `null`、无工具 `[]`);删协议外键(`faces` 在 `dsh.workbenchFaces`;不写 `scope`) |
9
9
  | `bundles` | 运行时互串:浏览器产物含 node 内置 / 宿主产物含 DOM、react | 不 import 对方那侧 |
10
- | `source` | 非种子 `@deepseek-ai/*`;宿主碰 dsh 浏览器包;`@/` 指外壳;根入口取运行值;客户端引 `/host` | 宿主只用 Node 侧;种子词仅在 client 可达文件;`@/` 只指自己 `src/`;运行值:浏览器 `kit`、宿主 `shared/host` |
10
+ | `source` | 非种子 `@deepseek-ai/*`;宿主碰 dsh 浏览器包;`@/` 指外壳;根入口取运行值;客户端引 `/host`;**手写进程 / PATH / 文件锁 / 状态原子写**(import 首选库放行) | 宿主只用 Node 侧;种子词仅在 client 可达文件;`@/` 只指自己 `src/`;运行值:浏览器 `kit`、宿主 `shared/host`;进程/锁/状态写交给外壳 |
11
11
  | `primitives` | 声明 `external` 但产物无物证(原语被内联) | `dsh.client.external` 声明;devDependency 精确版对齐;产物中为 `require(...)` |
12
12
  | `kit` | 用了 peer 下限外壳没有的成员(首帧 `Element type is invalid`) | 只用 peer 范围内成员;下限抬到实际使用版 |
13
13
  | `cards` | 七种外壳侧输入 × `zh` / `en` 下崩溃 / 空白 / 脏值 | 五态可画;外层 `Card`;`titleKey` 与卡片用到的键双语齐。不断言具体态(归 `plugin.test.ts`) |
14
14
  | `standalone` | 依赖工作台源码才能构建 | 不引用工作台源码;`tsconfig.paths` 用相对路径 |
15
- | `markers` | 内网域名 / 企业名进入公开包 | 不进包;配置落到模块配置面 |
15
+ | `markers` | 私有源 / 私网地址 / 内网域名进入公开包 | 不进包;配置落到模块配置面;组织特有的词表由 `DSH_WB_INTERNAL_MARKERS` 提供 |
16
16
  | `alias` | `@/` 指向工作台源码 | `@/` 只指自己 `src/` |
17
- | `style` | 模块定义 `.wb-*`;手写行 / 操作区 / 表单(F1–F4) | 样式走 `*.module.css`(无 `wb-` 前缀);借外壳类用 `:global(.wb-…)`;行 / 操作区用 `FormRow(s)` / `FormActions`,表单用 `Form`([KIT.md](KIT.md) §5)。F4:裸 `<form` 或手写 `wb-formRow` / `wb-formRows` / `wb-field` |
18
- | `arch` | 结构:巨文件 / 反向依赖 / 跨运行时 / 表外目录 / 模型无测试 | 见「第十二条」 |
19
- | `lint` | 语法:`as any` / `console` / `debugger` / 颜色字面量 / `!important` / react-hooks | 见「第十三条」 |
17
+ | `style` | 模块定义 `.wb-*`;手写行 / 操作区 / 表单(F1–F4);`--dsw-*` / `--wb-*` 不在现读的令牌清单 | 样式走 `*.module.css`(无 `wb-` 前缀);借外壳类用 `:global(.wb-…)`;行 / 操作区用 `FormRow(s)` / `FormActions`,表单用 `Form`([KIT.md](KIT.md) §5)。F4:裸 `<form` 或手写 `wb-formRow` / `wb-formRows` / `wb-field`。令牌名现查:`workbench_diy_components` `scope: 'tokens'` |
18
+ | `arch` | 结构:巨文件 / 反向依赖 / 跨运行时 / 表外目录 / 模型无测试;依赖白名单(含 execa / which / proper-lockfile / write-file-atomic / dayjs / zod)+ `shell-quote` / `shelljs` / `zx` deny;能力首选 dayjs / structuredClone / URLSearchParams / zod(日期已是硬门禁) | 见「第十二条」 |
19
+ | `lint` | 语法:`as any` / `console` / `debugger` / 颜色字面量 / `!important` / **直接读 `process.platform` / `versions.electron` / `dshDesktop` / `hostOs` / `navigator.userAgent`** / react-hooks | 见「第十三条」 |
20
20
 
21
21
  ## 第十二条 `arch`
22
22
 
@@ -71,7 +71,7 @@ export default moduleLint({ rootDir: import.meta.dirname });
71
71
  | `no-explicit-any` | `as any` / `: any` | 写真实类型;或在 `moduleLint({ rules })` 放行 |
72
72
  | `no-console` | `src/**` 的 `console.log` / `info` / `debug`(`warn` / `error` 放行) | 删除;`scripts/**` 不判 |
73
73
  | `no-debugger` | 残留 `debugger` | 删除 |
74
- | `no-restricted-syntax` | 颜色字面量(`#ff0000` / `rgb(` / `hsl(`)、字符串 `!important` | 用令牌与 `*.module.css` |
74
+ | `no-restricted-syntax` | 颜色字面量(`#ff0000` / `rgb(` / `hsl(`)、字符串 `!important`、平台原始事实(`process.platform` / `versions.electron` / `dshDesktop` / `hostOs` / `navigator.userAgent`) | 用令牌与 `*.module.css`;平台差异走能力面(`HostSurface` / `ClientSurface`),宿主/浏览器面分开写 |
75
75
  | `react-hooks/*` | 条件 hook / 渲染期写 ref / 漏依赖 | 提到顶层;副作用进 `useEffect`;补依赖 |
76
76
  | `no-unused-vars` | 死代码(`^_` 放行) | 删除或改 `_x` |
77
77
  | 其他 `recommended` / `react/*` | 语法规则 | 按 eslint 原文 |
@@ -12,11 +12,15 @@ description: 在工作台里把当前面板调明白,或者给它造一块新
12
12
 
13
13
  调交付"面板现在怎么样"的事实;造交付面板上能点开的一块内容。不交技术方案。
14
14
 
15
+ > **Desktop**:屏调试不可用(`debug_*`、`logs_*`、不带 `read` 的看/动都不会出现);**站点探索用
16
+ > `read=<地址>`**,**录制 `_record_*` 照旧**,`_panel` / `_status` / build / install 照旧。
17
+ > 验收时别调 `_debug_start`;用 `read` 或录制取证。
18
+
15
19
  ## 流程
16
20
 
17
21
  **0. 认路** —— 跑 `workbench_diy_status`,取 `工作区:<dir>`。
18
22
 
19
- **调** —— 用 [REVIEW.md](REVIEW.md) 的四步取证。动屏前 `workbench_diy_debug_start`(`unit` 可省)。
23
+ **调** —— 用 [REVIEW.md](REVIEW.md) 的四步取证。动屏前 `workbench_diy_debug_start`(`unit` 可省;Desktop 跳过)。
20
24
  抓"点了之后发了什么":`workbench_diy_record_prepare` → 用户操作 → `_record_read`;收工 `_debug_stop` / `_record_stop`。
21
25
  不需要源码、工具链、工坊。
22
26
 
@@ -27,8 +31,9 @@ description: 在工作台里把当前面板调明白,或者给它造一块新
27
31
  1. **判域** —— [DESIGN.md](DESIGN.md) §0。输出一句结论 + 下一步。
28
32
  2. **问三张表** —— 问法见 [STEPS.md](STEPS.md);只问用户能决定的事,实现不问。ASCII 画面 + 三张表当场写进
29
33
  `design.json`([DESIGN.md](DESIGN.md) §5)。
30
- 3. **定数据源** —— [DATASOURCE.md](DATASOURCE.md):探明后固化成一条读(`browserRead` / `browserFind`),写三态。
31
- 写操作先读 [WRITES.md](WRITES.md) 四步;有写工具就把审批屏画进 ASCII([DESIGN.md](DESIGN.md) §3 末节)。
34
+ 3. **定数据源** —— [DATASOURCE.md](DATASOURCE.md):探明后落成一条**配方**(`design.json` 的 `key + recipe`
35
+ → `dsh-wb-module sync` → `data.request`),配方盖不住的写 `custom: { why }`;写三态。
36
+ 写操作先读 [WRITES.md](WRITES.md) 四步 + 执行体;有写工具就把审批屏画进 ASCII([DESIGN.md](DESIGN.md) §3 末节)。
32
37
  4. **套模板** —— [BUILD.md](BUILD.md) §1–§2:`pnpm exec dsh-wb-module init <unit> --template diy`,
33
38
  先把 `design.json` 改成问出来的那份,再改数据源与渲染。init 后 `pnpm install`。不从零写。
34
39
  改渲染时文案按 [COPY.md](COPY.md):先判读者(卡片给人 / 描述给 agent / 原始输出进 detail)。
@@ -37,20 +42,24 @@ description: 在工作台里把当前面板调明白,或者给它造一块新
37
42
  6. **装、上板** —— `workbench_diy_install`(`unit=…`)。只装一次;之后 `dsh-wb-module build` 即可。
38
43
  状态不明问 `workbench_diy_status`(`unit=…`);只缺上板用 `workbench_diy_show`。装不问审批。
39
44
  7. **验收** —— 对着三张表在真卡片上走「打开哪 → 看什么 → 点什么 → 应该看到什么」。
40
- 看 / 动屏前 `workbench_diy_debug_start`(否则整族拒);`_panel` / `_status` / `read=` 档不用。
45
+ 看 / 动屏前 `workbench_diy_debug_start`(否则整族拒;Desktop 跳过,改用 `read=` / 录制);`_panel` / `_status` / `read=` 档不用。
41
46
  工具全表 [FAMILY.md](FAMILY.md)。走通才 `dsh-wb-module design accept`;走不通如实记"未验"。
42
47
  审批项标注「要你真用一次」,不打勾。结论只报:已装、在面板哪一格。
48
+ 8. **发布** —— 只在用户说「帮我发布」之后。先确认他已经在真卡片上说过「没问题」(`design accept` 已打勾),
49
+ 并把这一版写进 `CHANGELOG.md`:`workbench_diy_changelog`(`unit=…`,`note=…`;
50
+ 没写这一版 `release` 会拦下),再调 `workbench_diy_publish`(`unit=…`)。只问「给团队用、公开发、还是先给你一个安装包」;
51
+ 不展示 `package.json` / npm / 版本字段,也不要问 token。出口与 `needsUser` 处理见 [WIRING.md](WIRING.md) §5。
43
52
 
44
53
  ## 索引
45
54
 
46
55
  | 需要 | 读 |
47
56
  |---|---|
48
- | 判域、分工、三张表、ASCII 规则 | [DESIGN.md](DESIGN.md) |
49
- | 三步的问法、产出、完成判据 | [STEPS.md](STEPS.md) |
57
+ | 判域、三张表、ASCII 规则 | [DESIGN.md](DESIGN.md) |
58
+ | 步骤与完成判据 | [STEPS.md](STEPS.md) |
50
59
  | 探测数据源、固化读、错误码 | [DATASOURCE.md](DATASOURCE.md) |
51
60
  | 写通道四步、回读、撤销 | [WRITES.md](WRITES.md) |
52
61
  | 面板内容、状态矩阵、界面规则 | [PANEL.md](PANEL.md) |
53
- | 选 kit 组件、表单、hooks | [KIT.md](KIT.md) |
62
+ | 选组件、表单、hooks | [KIT.md](KIT.md) |
54
63
  | agent 能力、审批、长任务、外部供给 | [TOOLS.md](TOOLS.md) |
55
64
  | 文案:三类读者、主句 / 原文、人 / agent / 开发 | [COPY.md](COPY.md) |
56
65
  | DIY 工具族的参数与返回 | [FAMILY.md](FAMILY.md) |
@@ -58,17 +67,17 @@ description: 在工作台里把当前面板调明白,或者给它造一块新
58
67
  | 落点、模板文件、命令、两个面 | [BUILD.md](BUILD.md) |
59
68
  | 依赖、禁区、安装、热换、发布 | [WIRING.md](WIRING.md) |
60
69
  | 门禁报错、卡片故障取证 | [REVIEW.md](REVIEW.md) |
61
- | 哪些检查已固化成命令 | [TOOLING.md](TOOLING.md) |
62
70
 
63
71
  ## 查不到时
64
72
 
65
73
  1. `dsh-wb-module check --only <判据>` 的报错原文。
66
- 2. kit / dsh 原语:`workbench_diy_components`(DIY 会话);工程域 `check --only kit` / `--only primitives`。
74
+ 2. kit / dsh 原语 / CSS 令牌:`workbench_diy_components`(DIY 会话;令牌给 `scope: 'tokens'`,现读现给);
75
+ 工程域 `check --only kit` / `--only primitives`。
67
76
  3. 模板:`node_modules/@dsh-workbench/module-tools/template-diy/` 与 `template/`。
68
77
  4. 安装包的类型面:`node_modules/@dsh-workbench/core/dist/types/**`;本指引:`node_modules/@dsh-workbench/core/skills/workbench-module-diy/**`。
69
78
 
70
79
  ## 硬约束
71
80
 
72
81
  - dsh 已有的从 `kit` 拿(`@dsh-workbench/core/client`);不手搓 DOM + CSS,不直接 import dsh 的包。
73
- - DIY 模块 `private: true`,不发任何源。
74
- - 源码只许贴导出的 JSDoc;`//`、实现内注释、`.css` 注释都不许。理由写模块 `README.md` 或 spec。
82
+ - DIY 模块默认 `private: true`,不发任何源;用户确认后走 `workbench_diy_publish` 发到团队源 / 公网 / 安装包 / git。
83
+ - 源码零注释(`//`、块注释、`.css` 注释都不许);说明写模块 `README.md` 或 spec。
@@ -87,7 +87,7 @@
87
87
  判据:
88
88
 
89
89
  - 用户对着两张图看过一次真实变化。
90
- - 每格说清"何时变、哪格变、看到什么";"哪一格"细到"某投影 + 最窄参数"(`cmdb/builds?env=dev`)。
90
+ - 每格说清"何时变、哪格变、看到什么";"哪一格"细到"某投影 + 最窄参数"(`inventory/builds?env=dev`)。
91
91
  - 面板不停在旧值;允许延迟但要说清。
92
92
  - 每个"交给 agent"都说清 agent 收到的内容。
93
93
 
@@ -88,15 +88,39 @@
88
88
 
89
89
  ## 8 外部供给
90
90
 
91
- `env` 声明能力依赖,外壳隔离运行时按它装、探,状态见 `workbench_modules_list`。
92
- 形状:`env: { command, libs: [{ name, registryEnv, registryDefault, purpose }], plugins: [{ name, commands, installSource }] }`。
93
-
94
- - `libs[]` 四项必填:`registryEnv` 让用户源覆盖 `registryDefault`;`purpose` 是给用户的一句用途。
95
- `installSource`:`{kind:'npm', package, registryEnv}` / `{kind:'git', url}` / `{kind:'local', env}`。
96
- - 未装好文案由模块写:`libInstallCommand({ need })`(`@dsh-workbench/shared/host`)拼好源与缓存目录,原样输出;
97
- 放进失败态。
98
- - `contracts` 判据:`env` 非空;`libs` 缺 `purpose` / `registryEnv`、`registryDefault` 非 `http(s)://` 或 `file://`、
99
- `installSource` 错误都红;声明 `libs` 必须用 `libInstallCommand`。
91
+ `needs` 声明能力依赖,外壳按 `kind` 去探、去装,状态见 `workbench_modules_list`。
92
+
93
+ 四种 `kind`:`bin`(机器上的命令)/ `extension`(运行时插件)/ `lib`(共用 npm 依赖)/ `env`(环境变量)。
94
+ 每条必写 `purpose`(给用户看的那半句);`required: false` 只降级、不挡卡片。
95
+
96
+ ```jsonc
97
+ "needs": [
98
+ {
99
+ "kind": "extension",
100
+ "runtime": "opencli",
101
+ "name": "acme-workflow",
102
+ "commands": ["acme-read", "acme-write"],
103
+ "purpose": "读写工单",
104
+ "sources": [
105
+ { "kind": "npm", "package": "opencli-plugin-acme", "registryEnv": "ACME_REGISTRY" },
106
+ { "kind": "git", "url": "git@internal:plugin-acme.git" },
107
+ { "kind": "local", "env": "ACME_PLUGIN_PATH" }
108
+ ]
109
+ },
110
+ { "kind": "lib", "name": "opencli-workflow", "purpose": "发布编排" },
111
+ { "kind": "bin", "name": "acme", "purpose": "平台命令" },
112
+ { "kind": "env", "name": "ACME_TOKEN", "purpose": "访问令牌", "secret": true }
113
+ ]
114
+ ```
115
+
116
+ - `sources` 按顺序试(本地 → 私有 → 公共)。没写 `sources` 就是「我自己装,你只帮我判」——外壳只探不代装。
117
+ - `extension` 的 `sources[].kind` 只有 `npm` / `git` / `local`;`lib` 只认 `npm`。
118
+ 未知 `kind` 或 `source.kind` 判红;need 里未知字段只警告,`x-` 前缀忽略。
119
+ - 未装好文案由模块写:`libInstallCommand({ need, source })`(`@dsh-workbench/shared/host`)拼好源与缓存目录,
120
+ 原样输出;放进失败态。
121
+ - `contracts` 判据:`apiVersion` 必须是 2;`needs` 走同一份 `NEED_KINDS` 注册表校验(`purpose` 必填、
122
+ `bin`/`env` 不许带 `sources`、`lib` 只认 npm 源);声明了 `lib` 必须用 `libInstallCommand`。
123
+ 未知 `runtime` 不判红:探针会给「这个运行时工作台还不认识」的 `unchecked`,等运行时 provider 补上。
100
124
 
101
125
  ## 9 长任务
102
126
 
@@ -30,11 +30,11 @@
30
30
  |---|---|
31
31
  | DOM + CSS 重画 dsh 已有控件(按钮、弹窗、输入框、图标) | 第二份材质与交互;先从 `kit` 取 |
32
32
  | `import '@deepseek-ai/dsh-client-ui-primitives'` | 允许,需三处齐:仅浏览器侧、`dsh.client.external` 声明、产物中为 `require`(否则被内联,`primitives` 红) |
33
- | `import '@/shared/…'`、`../../workbench/src/…` | `@/` 只指自己 `src/`;跨包用包名 |
33
+ | `import '@/shared/…'`、`../../core/src/…` | `@/` 只指自己 `src/`;跨包用包名 |
34
34
  | 公开包写内网地址 / 域名 / 企业名 | `markers` 红 |
35
35
 
36
36
  纪律:样式走 `*.module.css`,类名不带 `wb-` 前缀(外壳全局类;借契约类写 `:global(.wb-…)`);
37
- `src/**` 只许贴导出的 JSDoc。
37
+ `src/**` 零注释;说明写 `README.md` 或 spec。
38
38
 
39
39
  ## 3 安装、上板
40
40
 
@@ -60,7 +60,19 @@ DIY 族仅在选了 DIY 模式的会话出现(按模式,不按工作区)
60
60
 
61
61
  ## 5 发布
62
62
 
63
- DIY 模块 `private: true`,不发任何源。
64
-
65
- 需要发布时:`pnpm exec dsh-wb-module publish`(门禁 + 三张表 + `files` 漏项,仅 dry run);
66
- 通过后移除 `private`,显式写 `publishConfig.access` 或内网 `publishConfig.registry`。
63
+ 默认 `private: true`,不发任何源。用户说「帮我发布」时,**不要手改 `package.json`、不要让他看 npm**,
64
+ 走 `workbench_diy_publish`(`unit=…`):
65
+
66
+ 1. 先确认他已经在真卡片上说过「没问题」,并已跑过 `design accept`(验收 N/N 全勾)。
67
+ 还要把这一版写进 `CHANGELOG.md`:调 `workbench_diy_changelog`(`unit=…`,`note=…`);
68
+ 没有这一版的记录(或包里没带 `CHANGELOG.md`)时 `release` 会拦下,并给出补的命令。
69
+ 2. 工具一次做完预检(登录 / license / git 远端 / 工作区)→ 全门禁 → 按出口发布 → 发后核包。
70
+ 发布审批屏会把这一版的更新日志按 markdown 展示给用户。
71
+ 3. 出口只有四种:团队源(配了私源时默认)、公网 npm(必须用户明确说“公开”)、安装包(没私源时默认,
72
+ 零凭据)、git(提交构建产物 + tag + push)。只问「给团队用、公开发、还是先给你一个安装包」;
73
+ 凭据细节由预检接管。
74
+ 4. 工具回 `needsUser` 时,照它那句 `text` 对用户说一句,给能照抄的命令,等他说「好了」再跑;
75
+ **不在对话里要 token / OTP**,不把红字贴给用户。`otp` 交接后用 `workbench_diy_publish` 的 `verify=true`
76
+ (或 `release --verify`)只核不发。
77
+ 5. `dsh-wb-module publish` 仍是**发货前清单**(只 dry run);`release --dry-run` 只预览;
78
+ `--verify` 只核已发布的包。公网源必须显式 `--target public` + license,默认只认团队源 / 安装包。
@@ -10,11 +10,11 @@
10
10
  `读` · `写(可预览)` · `写(无预览档,一次就是真的)`,并给入参签名(`--id --yes=false`)。
11
11
  命中即复用(自造会绕过登录、XSRF、错误码处理)。
12
12
  只命中写命令时,末句提示:先 `--help` 看入参;带 `--dryRun` / `--yes` 的先走预览;**无预览档不许试写**。
13
- 边界:recon 只覆盖 opencli 自带目录;`cmdb` / `coding` 等插件只回命令名,参数走第 2 步。
13
+ 边界:recon 只覆盖 opencli 自带目录;`inventory` / `demo` 等插件只回命令名,参数走第 2 步。
14
14
 
15
15
  2. **查入参 / 出参**(按可信度):
16
16
 
17
- - `workbench_diy_spec`(`command='<site> <name>'`,`cmdb publish` / `cmdb/publish` 均可):
17
+ - `workbench_diy_spec`(`command='<site> <name>'`,`inventory publish` / `inventory/publish` 均可):
18
18
  返回 `opencli <site> <name> --help -f json` 原文;JSON 时另给 `spec`(`access`、`positionals`、
19
19
  `command_options[{name, required, help, default}]`、出参列)。不碰屏、不需约定。
20
20
  - recon 的 `args`(必填 / 默认值)与 `preview` 标记,仅覆盖自带目录;插件以 `_spec` 为准。
@@ -47,9 +47,30 @@
47
47
 
48
48
  4. **文档 / 问用户** —— 接口文档、curl 样例都可用于确认需求;问法照 [STEPS.md](STEPS.md),不问技术细节。
49
49
 
50
+ ## 执行体(写工具里那一下)
51
+
52
+ 写工具被点头之后,按这个顺序选:
53
+
54
+ 1. **有现成 opencli 写命令** → `opencli <site> <name> …`;`--yes` 只在 `confirm === true` 时加,
55
+ 没有预览档的写不许试写(见上面四步)。
56
+ 2. **没有命令、但能落配方** → `data.submit(recipe, { body })`。预览用
57
+ `describeRecipe(recipe)`(`@dsh-workbench/shared/host`)回 `{ method, url, body }`,
58
+ 凭据只回"放在哪";真写才调 `submit`。
59
+ 3. **都不行**(签名 / WS / 多步 / 一次性 token)→ 旧的 `data.read({ kind: 'browser', script })`,
60
+ 在 `design.json` 里写 `custom: { why }`,脚本留在代码里。
61
+
62
+ 三条都不自动重试:失败先回读,再决定。写完的回读用同一份 `DATASOURCE` 里的读配方(或同族命令)。
63
+
64
+ 第 2 条走的是哪条传输由壳决定(页面脚本 / 宿主侧的公共通道),模块看不见也不该依赖 ——
65
+ `submit` 的返回形状、错误码、审批、回读全都一样。
66
+
67
+ **录制 → 配方**:`_record_detail` 的原文是取证。method / path / body / contentType 抄进配方;
68
+ `authorization` / `cookie` / `x-csrf-*` 这些头**丢掉**,改写成 `auth.source` + `auth.place`;
69
+ 一次性 token / 签名 / 多步 → `custom`。"授权观察一次 ≠ 授权重放":每次 `submit` 都重新审批。
70
+
50
71
  ## 硬纪律
51
72
 
52
- - **预览**:先确认是否有 `yes` / `dryRun` / `confirm` 档;有则先走预览。`opencli cmdb publish` / `cmdb build`
73
+ - **预览**:先确认是否有 `yes` / `dryRun` / `confirm` 档;有则先走预览。`opencli inventory publish` / `inventory build`
53
74
  无预览开关,调用即真发布 / 真构建。**无预览档不许试写。**
54
75
  - 要新凭据 / 多步长流程 / 新依赖 → 工程域。
55
76
 
@@ -74,7 +95,7 @@
74
95
 
75
96
  ## design.json:writes[]
76
97
 
77
- 字段七个必填、一个可空:
98
+ 字段七个必填、三个可空(`probeCommand` / `key + recipe` / `custom`):
78
99
 
79
100
  | 字段 | 行名 |
80
101
  |---|---|
@@ -86,6 +107,11 @@
86
107
  | `undo` | 撤销 / 删除;无则"没有配对,一次就是真的" |
87
108
  | `failure` | 失败形态(含"可能已经写了") |
88
109
  | `probeCommand`(可空) | 探明 / 预览调用原文 |
110
+ | `key` + `recipe`(可空,成对) | 调用形状(配方):写走 `data.submit` 时填,`sync` 把它和读一起生成进 `src/datasource.ts`(`DATASOURCE.<key>`)。`key` 不许和读撞,撞了 `design check` 红 |
111
+ | `custom`(可空) | 只记 `why`:配方盖不住的写(签名 / 多步 / 一次性 token),脚本仍留代码里;与 `recipe` 二选一,`design check` 记 warn |
112
+
113
+ 写了 `key + recipe` 的写,预览用 `describeRecipe(DATASOURCE.<key>)`,执行用
114
+ `data.submit(DATASOURCE.<key>, overrides)`;不再把 origin / path 写进代码。
89
115
 
90
116
  `design render` 写入 README 的 `### 写通道探明记录`(位于「数据源探明记录」与「验收」之间)。
91
117
  `design check` 点名空格;无写通道的模块不写。
@@ -1,136 +0,0 @@
1
- export declare const BUNDLE_REGISTRIES_ROUTE = "bundle-registries";
2
- export declare const BUNDLE_INSPECT_ROUTE = "bundle-inspect";
3
- export declare const BUNDLE_REGISTRY_DEFAULT = "default";
4
- export declare const MODULE_VERSIONS_ROUTE = "module-versions";
5
- export type BundleRegistry = string | null;
6
- export interface BundleRegistries {
7
- readonly registry: BundleRegistry;
8
- readonly fallbackRegistries: readonly BundleRegistry[];
9
- readonly resolved: string | null;
10
- }
11
- export type BundleInspectProblem = 'invalid-spec' | 'already-installed' | 'not-found' | 'not-a-package' | 'not-a-bundle' | 'not-a-workbench-module' | 'not-a-module-or-plugin' | 'network' | 'unknown';
12
- export type BundleSpecKind = 'registry' | 'path' | 'git' | 'tarball';
13
- export interface BundleInspectionAccepted {
14
- readonly status: 'accepted';
15
- readonly kind: BundleSpecKind;
16
- readonly name?: string;
17
- readonly version?: string;
18
- readonly description?: string;
19
- readonly bundle: boolean | null;
20
- readonly registry: BundleRegistry;
21
- readonly host?: string;
22
- }
23
- export interface BundleInspectionRefused {
24
- readonly status: 'refused';
25
- readonly problem: BundleInspectProblem;
26
- readonly reason: string;
27
- readonly registries?: readonly BundleRegistry[];
28
- }
29
- export interface BundleInspectionPlugin {
30
- readonly status: 'plugin';
31
- readonly pkg: string;
32
- readonly registry: BundleRegistry;
33
- readonly pluginName?: string;
34
- readonly version?: string;
35
- }
36
- export type BundleInspection = BundleInspectionAccepted | BundleInspectionRefused | BundleInspectionPlugin;
37
- export interface BundleRegistriesPayload {
38
- readonly available: boolean;
39
- readonly registries: BundleRegistries | null;
40
- }
41
- export interface BundleInspectionPayload {
42
- readonly inspection: BundleInspection;
43
- }
44
- export type BundleApplication = 'applied' | 'restart-required' | 'overridden' | 'failed' | 'cancelled';
45
- export declare const SELF_UPDATE_STATES: readonly ["running", "ok", "rolled-back", "failed"];
46
- export type SelfUpdateState = (typeof SELF_UPDATE_STATES)[number];
47
- export interface WorkbenchSelfUpdate {
48
- readonly state: SelfUpdateState;
49
- readonly profile?: string;
50
- readonly from?: string;
51
- readonly to?: string;
52
- readonly version?: string;
53
- readonly at?: string;
54
- readonly tail?: string;
55
- }
56
- export declare const RESTART_REASONS: readonly ["no-hmr", "package-moved", "host-module", "unmanaged-plugin", "module-comparison"];
57
- export type RestartReason = (typeof RESTART_REASONS)[number];
58
- export type BundleChangeStage = 'install' | 'enable' | 'remove';
59
- export type BundleFailureKind = 'pnpm-missing' | 'timeout' | 'not-found' | 'no-matching-version' | 'network' | 'disk-full' | 'permission' | 'build-blocked' | 'integrity' | 'unknown';
60
- export interface BundlePackageResult {
61
- readonly exitCode: number;
62
- readonly output: string;
63
- readonly truncated: boolean;
64
- readonly logPath: string;
65
- readonly kind?: BundleFailureKind;
66
- }
67
- export interface BundleChange {
68
- readonly application: BundleApplication;
69
- readonly stage: BundleChangeStage;
70
- readonly changed: boolean;
71
- readonly target: string;
72
- readonly bundle?: string;
73
- readonly version?: string;
74
- readonly errorCode?: string;
75
- readonly errorDetail?: string;
76
- readonly packageResult?: BundlePackageResult;
77
- readonly pendingBuilds?: readonly string[];
78
- readonly restartReason?: RestartReason;
79
- readonly failedAt?: 'registry' | 'spec-host';
80
- }
81
- export interface BundleInstallRequest {
82
- readonly spec: string;
83
- readonly registry?: BundleRegistry;
84
- readonly requestId?: string;
85
- readonly approvedBuilds?: readonly string[];
86
- }
87
- export type BundleCancellation = 'cancelled' | 'too-late' | 'not-running';
88
- export type BundleSupplyState = 'not-a-module' | 'no-needs' | 'installed' | 'failed' | 'pending-restart';
89
- export interface BundleModulePayload {
90
- readonly kind: 'module' | 'not-module' | 'unknown';
91
- readonly pkg: string;
92
- readonly unit?: string;
93
- readonly version?: string;
94
- }
95
- export interface BundleSupplyPayload {
96
- readonly state: BundleSupplyState;
97
- readonly reason?: string;
98
- }
99
- export interface BundleInstalledPlugin {
100
- readonly kind: 'opencli-plugin';
101
- readonly pkg: string;
102
- readonly name?: string;
103
- }
104
- export interface BundleInstallPayload {
105
- readonly change: BundleChange;
106
- readonly module: BundleModulePayload;
107
- readonly supply: BundleSupplyPayload;
108
- readonly plugin?: BundleInstalledPlugin;
109
- }
110
- export interface BundleRemovePayload {
111
- readonly change: BundleChange;
112
- readonly keptFor: readonly string[];
113
- }
114
- export interface BundleCancellationPayload {
115
- readonly cancellation: BundleCancellation | null;
116
- }
117
- export interface ModuleVersion {
118
- readonly unit: string;
119
- readonly pkg: string;
120
- readonly installed: string;
121
- readonly latest?: string;
122
- readonly local?: boolean;
123
- readonly refused?: readonly string[];
124
- }
125
- export interface WorkbenchVersion {
126
- readonly pkg: string;
127
- readonly installed: string;
128
- readonly latest?: string;
129
- readonly running?: string;
130
- readonly local?: boolean;
131
- }
132
- export interface ModuleVersionsPayload {
133
- readonly modules: readonly ModuleVersion[];
134
- readonly workbench?: WorkbenchVersion;
135
- readonly selfUpdate?: WorkbenchSelfUpdate;
136
- }
@@ -1,35 +0,0 @@
1
- export declare const CONFIG_SYNC_ROUTE = "config-sync";
2
- export declare const CONFIG_SYNC_RESOURCE = "configSync";
3
- export type ConfigSyncState = 'new' | 'differs';
4
- export interface ConfigSyncRow {
5
- readonly key: string;
6
- readonly id: string;
7
- readonly insert: boolean;
8
- readonly state: ConfigSyncState;
9
- readonly body: string;
10
- readonly ownBody: string | null;
11
- readonly missing: readonly string[];
12
- }
13
- export interface ConfigSyncProfile {
14
- readonly name: string;
15
- readonly readable: boolean;
16
- readonly candidates: number;
17
- }
18
- export interface ConfigSyncSnapshot {
19
- readonly self: string;
20
- readonly home: string;
21
- readonly source: string;
22
- readonly profiles: readonly ConfigSyncProfile[];
23
- readonly rows: readonly ConfigSyncRow[];
24
- readonly emptyProviders: boolean;
25
- readonly reason?: string;
26
- }
27
- export interface ConfigSyncApplied {
28
- readonly written: readonly string[];
29
- readonly skipped: readonly string[];
30
- }
31
- export interface ConfigSyncRequest {
32
- readonly source: string;
33
- readonly keys: readonly string[];
34
- readonly overwrite: readonly string[];
35
- }
@@ -1,11 +0,0 @@
1
- export declare const DSH_PLUGINS_ROUTE = "dsh-plugins";
2
- export interface DshPluginRow {
3
- readonly name: string;
4
- readonly version: string;
5
- readonly enabled: boolean;
6
- }
7
- export interface DshPluginsSnapshot {
8
- readonly available: boolean;
9
- readonly bundles: readonly DshPluginRow[];
10
- readonly plugins: readonly DshPluginRow[];
11
- }
@@ -1,11 +0,0 @@
1
- import type { DshHostContext } from '@dsh-workbench/shared';
2
- import type { BundleCancellation, BundleChange, BundleInspection, BundleInstallRequest, BundleRegistries, BundleRegistry } from '../bundle-install.js';
3
- export interface BundleManager {
4
- registries(): Promise<BundleRegistries | null>;
5
- inspect(spec: string, registry?: BundleRegistry): Promise<BundleInspection | null>;
6
- install(request: BundleInstallRequest): Promise<BundleChange | null>;
7
- remove(name: string): Promise<BundleChange | null>;
8
- setEnabled?(name: string, enabled: boolean): Promise<BundleChange | null>;
9
- cancel(requestId: string): Promise<BundleCancellation | null>;
10
- }
11
- export declare function readBundleManager(ctx: DshHostContext): BundleManager | undefined;
@@ -1,46 +0,0 @@
1
- import type { PostResource, RouteHandler } from '@dsh-workbench/shared/host';
2
- import type { ConfigSyncRow, ConfigSyncSnapshot } from '../config-sync.js';
3
- export interface PatchBlock {
4
- readonly key: string;
5
- readonly id: string;
6
- readonly insert: boolean;
7
- readonly body: string;
8
- readonly names: readonly string[];
9
- }
10
- export declare function patchBlocks(text: string): PatchBlock[];
11
- export declare function normalizeBlock(body: string): string;
12
- export declare function syncRows(source: readonly PatchBlock[], own: readonly PatchBlock[], missing: (block: PatchBlock) => readonly string[]): ConfigSyncRow[];
13
- export declare function mergeBlocks(ownText: string, incoming: readonly PatchBlock[], overwrite: ReadonlySet<string>): {
14
- ok: true;
15
- text: string;
16
- written: string[];
17
- skipped: string[];
18
- } | {
19
- ok: false;
20
- reason: string;
21
- };
22
- export declare function readPatchBlocks(path: string): {
23
- ok: true;
24
- text: string;
25
- blocks: PatchBlock[];
26
- } | {
27
- ok: false;
28
- reason: string;
29
- };
30
- export declare function writePatchFile(path: string, text: string): void;
31
- export interface ConfigSyncDeps {
32
- readonly home: string;
33
- readonly self: string;
34
- readonly profileDir: string | null;
35
- }
36
- export declare function configSyncHandler(deps: ConfigSyncDeps): RouteHandler;
37
- export declare function configSyncSnapshot(deps: ConfigSyncDeps, asked?: string): ConfigSyncSnapshot;
38
- export declare function configSyncApply(deps: ConfigSyncDeps, payload: unknown): {
39
- ok: true;
40
- written: string[];
41
- skipped: string[];
42
- } | {
43
- ok: false;
44
- text: string;
45
- };
46
- export declare function configSyncAction(deps: ConfigSyncDeps): PostResource;
@@ -1,35 +0,0 @@
1
- import type { DshAgentPresetRow, DshHostContext } from '@dsh-workbench/shared';
2
- /**
3
- * DIY 模式挂不起来时给用户的那条修法:升级 dsh,再重启一次工作台(启动器那道拒绝用的是同一条)。
4
- */
5
- export declare const DIY_UPGRADE_COMMAND = "npm i -g @deepseek-ai/dsh@latest";
6
- /**
7
- * 一次 DIY 模式体检的结论:`ok` 为真 = 名册里有那一行且挂着;为假时 `rows` 是挂不起来的行名、`detail` 是 dsh 给的原文。
8
- */
9
- export interface DiyPresetVerdict {
10
- readonly ok: boolean;
11
- readonly rows: readonly string[];
12
- readonly detail: string;
13
- }
14
- /**
15
- * 把 dsh 名册里那句 `broken` 原文拆成一项一个行名。
16
- * @param detail - registry 给的原文,一行一项,形如 `tool-schedule (@deepseek-ai/dsh-tool-schedule): never started`。
17
- * @returns 每行 `(` 之前那一段;空原文给空数组。
18
- */
19
- export declare function brokenRowsOf(detail: string): readonly string[];
20
- /**
21
- * 从 preset 名册判 DIY 模式挂不挂得起来。
22
- * @param presets - `agentPresets.list()` 的回值。
23
- * @returns 名册还空着(preset 行还没登记完)给 `undefined` —— 那是"还不知道",不是故障;否则给结论。
24
- */
25
- export declare function diyPresetVerdictOf(presets: readonly DshAgentPresetRow[]): DiyPresetVerdict | undefined;
26
- /**
27
- * 造一个读 preset 名册的探针:名册还没登记完就每 `everyMs` 重读,到 `deadlineMs` 还没读到就放弃。
28
- * @param ctx - 宿主上下文(取 `agentPresets` 服务;那个服务不在时给一个恒回 `undefined` 的探针)。
29
- * @param options - 两个时间旋钮(测试用):多久放弃、隔多久重读。
30
- * @returns 探针:调一次读一轮,`undefined` 表示"这次没读到"。
31
- */
32
- export declare function createDiyPresetProbe(ctx: DshHostContext, options?: {
33
- deadlineMs?: number;
34
- everyMs?: number;
35
- }): () => Promise<DiyPresetVerdict | undefined>;
@@ -1,5 +0,0 @@
1
- import type { DshHostContext } from '@dsh-workbench/shared';
2
- import type { RouteHandler } from '@dsh-workbench/shared/host';
3
- import type { DshPluginsSnapshot } from '../dsh-plugins.js';
4
- export declare function readDshPlugins(ctx: DshHostContext): Promise<DshPluginsSnapshot>;
5
- export declare function dshPluginsHandler(ctx: DshHostContext): RouteHandler;
@@ -1,54 +0,0 @@
1
- import type { DshHostContext } from '@dsh-workbench/shared';
2
- import type { UnitDeclarationSource } from './unit-registry';
3
- export type InstalledModule = {
4
- readonly kind: 'module';
5
- readonly pkg: string;
6
- readonly unit: string;
7
- readonly version: string;
8
- readonly registry?: string;
9
- readonly local?: boolean;
10
- } | {
11
- readonly kind: 'not-module';
12
- readonly pkg: string;
13
- } | {
14
- readonly kind: 'unknown';
15
- readonly pkg: string;
16
- };
17
- export declare function isPackageName(value: string): boolean;
18
- export declare function profileDirOf(ctx: DshHostContext): string | null;
19
- export interface ProfileModule {
20
- readonly pkg: string;
21
- readonly unit: string;
22
- readonly version: string;
23
- readonly registry?: string;
24
- readonly local?: boolean;
25
- }
26
- export declare function profileManifestOf(profileDir: string | null): Readonly<Record<string, unknown>> | undefined;
27
- export declare function profileModules(profileDir: string | null): readonly ProfileModule[];
28
- export declare function createDeclarationLookup(profileDir: string | null): (unit: string) => UnitDeclarationSource | undefined;
29
- export declare function moduleDeclarationOf(profileDir: string | null, pkg: string): unknown;
30
- export interface DeclarationGap {
31
- readonly pkg: string;
32
- readonly problems: readonly string[];
33
- }
34
- export declare function declarationGaps(profileDir: string | null): readonly DeclarationGap[] | undefined;
35
- export declare function declaredPluginCommands(profileDir: string | null): ReadonlyMap<string, ReadonlySet<string>>;
36
- export declare function readInstalledModule(profileDir: string | null, pkg: string): InstalledModule;
37
- /**
38
- * 这份依赖是不是"从一个**打好的包**装的"(`file:/tmp/dsh-workbench-core-0.3.8.tgz`、
39
- * `./x-0.3.8.tgz`)。它跟 `link:` / 目录装的**不是**一回事:那是工作树(改了立刻生效,
40
- * 也不可能跟源上比出个新旧),而 tgz 是打包产物 —— 包名与版本就是源上那一套,能比、
41
- * 也该让人更新。混在一起会把"从文件装的发布产物"说成"本仓正在开发的那一份",
42
- * 顺带把版本比对与更新一起关掉。
43
- */
44
- export declare function isPackedArtifactSpec(spec: string): boolean;
45
- /** 这份依赖是不是"本仓那份"(`link:` / 目录 / 相对或绝对路径)—— 只有工作树才算。 */
46
- export declare function isLocalDependencySpec(spec: string): boolean;
47
- export interface ProfilePackage {
48
- readonly pkg: string;
49
- readonly version: string;
50
- readonly registry?: string;
51
- readonly local?: boolean;
52
- }
53
- export declare function readProfilePackage(profileDir: string | null, pkg: string): ProfilePackage | undefined;
54
- export declare function packageVersionAt(packageRoot: string): string | undefined;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import type { DshHostContext } from '@dsh-workbench/shared';
2
- export type OpencliSource = 'env' | 'isolated' | 'path';
3
- export interface OpencliResolution {
4
- readonly command: string;
5
- readonly source: OpencliSource;
6
- readonly isolated: string | null;
7
- }
8
- export declare const OPENCLI_PATH_FALLBACK = "opencli";
9
- export declare function isolatedOpencliPathOf(ctx: DshHostContext): string | null;
10
- export declare function opencliCommandOf(ctx: DshHostContext): OpencliResolution;