@dsh-workbench/shared 0.3.11 → 1.0.0-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 (371) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/dist/api/blocker-table.d.ts +3 -3
  4. package/dist/api/blocker-table.js +47 -23
  5. package/dist/api/dsh.d.ts +1 -1
  6. package/dist/api/workbench-client.js +2 -1
  7. package/dist/components/Activity.css +0 -1
  8. package/dist/components/ApprovalDetail.css +1 -2
  9. package/dist/components/ApprovalDetail.d.ts +1 -1
  10. package/dist/components/ApprovalPlan.css +0 -1
  11. package/dist/components/Card.css +0 -1
  12. package/dist/components/Card.d.ts +1 -1
  13. package/dist/components/CardBoundary.d.ts +1 -1
  14. package/dist/components/CardHead.css +0 -1
  15. package/dist/components/CardHead.d.ts +1 -1
  16. package/dist/components/ChoiceGroup.css +1 -2
  17. package/dist/components/ConfirmBar.d.ts +1 -1
  18. package/dist/components/ConfirmBar.js +1 -1
  19. package/dist/components/Form.css +1 -1
  20. package/dist/components/FormActions.js +1 -1
  21. package/dist/components/LongTaskRow.css +1 -2
  22. package/dist/components/LongTaskRow.d.ts +1 -1
  23. package/dist/components/LongTaskRow.js +1 -1
  24. package/dist/components/Note.css +0 -1
  25. package/dist/components/ResourceStates.css +0 -1
  26. package/dist/components/SettingsSection.css +0 -1
  27. package/dist/components/Spinner.css +0 -1
  28. package/dist/components/Stack.css +0 -1
  29. package/dist/components/StateBlock.css +0 -1
  30. package/dist/components/board-module.d.ts +3 -3
  31. package/dist/components/icons.d.ts +1 -1
  32. package/dist/components/icons.js +11 -4
  33. package/dist/config/constants.d.ts +2 -2
  34. package/dist/config/constants.js +2 -2
  35. package/dist/contract/adapters.d.ts +10 -0
  36. package/dist/contract/cli.d.ts +3 -0
  37. package/dist/contract/data.d.ts +126 -0
  38. package/dist/{api → contract}/facts.d.ts +12 -3
  39. package/dist/{api → contract}/facts.js +19 -1
  40. package/dist/contract/needs.d.ts +132 -0
  41. package/dist/contract/needs.js +232 -0
  42. package/dist/contract/plugin-source.d.ts +1 -0
  43. package/dist/contract/protocol/bundle-install.d.ts +136 -0
  44. package/dist/contract/protocol/bundle-install.js +12 -0
  45. package/dist/contract/protocol/config-sync.d.ts +55 -0
  46. package/dist/contract/protocol/config-sync.js +2 -0
  47. package/dist/contract/protocol/diy.d.ts +4 -0
  48. package/dist/contract/protocol/diy.js +4 -0
  49. package/dist/contract/protocol/dsh-plugins.d.ts +11 -0
  50. package/dist/contract/protocol/dsh-plugins.js +1 -0
  51. package/dist/contract/protocol/long-tasks.d.ts +13 -0
  52. package/dist/contract/protocol/long-tasks.js +1 -0
  53. package/dist/contract/protocol/market-index.d.ts +195 -0
  54. package/dist/contract/protocol/market-index.js +7 -0
  55. package/dist/contract/protocol/platform.d.ts +44 -0
  56. package/dist/contract/protocol/platform.js +1 -0
  57. package/dist/contract/protocol/preflight-wake.d.ts +7 -0
  58. package/dist/contract/protocol/preflight-wake.js +1 -0
  59. package/dist/contract/protocol/profile-create.d.ts +30 -0
  60. package/dist/contract/protocol/profile-create.js +2 -0
  61. package/dist/contract/protocol/sidebar-edition.d.ts +14 -0
  62. package/dist/contract/protocol/sidebar-edition.js +2 -0
  63. package/dist/contract/protocol/unit-manifests.d.ts +6 -0
  64. package/dist/contract/protocol/unit-manifests.js +1 -0
  65. package/dist/contract/unit-board.js +1 -0
  66. package/dist/contract/unit-capability.d.ts +34 -0
  67. package/dist/contract/unit-capability.js +1 -0
  68. package/dist/{host → contract}/unit-declaration.d.ts +7 -5
  69. package/dist/{api → contract}/unit-declaration.js +19 -13
  70. package/dist/contract/unit.d.ts +57 -0
  71. package/dist/contract/unit.js +24 -0
  72. package/dist/contract/workbench-contract.d.ts +15 -0
  73. package/dist/contract/workbench-contract.js +1 -0
  74. package/dist/host/adapter-set.d.ts +26 -0
  75. package/dist/host/adapter-set.js +243 -0
  76. package/dist/host/adapter-types.d.ts +79 -0
  77. package/dist/host/adapter-types.js +23 -0
  78. package/dist/host/adapters.d.ts +22 -0
  79. package/dist/host/adapters.js +9 -0
  80. package/dist/host/browser.d.ts +3 -0
  81. package/dist/host/browser.js +3 -0
  82. package/dist/host/changelog.d.ts +21 -0
  83. package/dist/host/changelog.js +188 -0
  84. package/dist/host/channel-plugin.d.ts +15 -0
  85. package/dist/host/channel-plugin.js +42 -0
  86. package/dist/host/cli.d.ts +4 -0
  87. package/dist/host/cli.js +7 -0
  88. package/dist/host/command-name.d.ts +1 -0
  89. package/dist/host/command-name.js +14 -0
  90. package/dist/host/data-error.d.ts +13 -0
  91. package/dist/host/data-error.js +20 -0
  92. package/dist/host/data-root.js +3 -0
  93. package/dist/host/diy-debug.js +2 -1
  94. package/dist/host/diy-record.js +2 -1
  95. package/dist/host/facts.d.ts +1 -1
  96. package/dist/host/facts.js +3 -2
  97. package/dist/host/git.js +2 -2
  98. package/dist/host/http.js +1 -1
  99. package/dist/host/lib-capabilities.d.ts +22 -0
  100. package/dist/host/lib-capabilities.js +37 -0
  101. package/dist/host/lib-install.d.ts +9 -0
  102. package/dist/host/lib-install.js +10 -0
  103. package/dist/host/long-task.d.ts +1 -1
  104. package/dist/host/long-task.js +4 -3
  105. package/dist/host/market-index.d.ts +22 -0
  106. package/dist/host/market-index.js +420 -0
  107. package/dist/host/needs.d.ts +4 -0
  108. package/dist/host/needs.js +2 -0
  109. package/dist/host/patch.d.ts +9 -0
  110. package/dist/host/patch.js +78 -0
  111. package/dist/host/paths.d.ts +12 -0
  112. package/dist/host/paths.js +28 -0
  113. package/dist/host/platform.d.ts +14 -0
  114. package/dist/host/platform.js +40 -0
  115. package/dist/host/plugin-source.d.ts +8 -6
  116. package/dist/host/plugin-source.js +43 -33
  117. package/dist/host/plugin.d.ts +4 -0
  118. package/dist/host/plugin.js +39 -0
  119. package/dist/host/port-types.d.ts +191 -0
  120. package/dist/host/port-types.js +1 -0
  121. package/dist/host/preflight.d.ts +28 -0
  122. package/dist/host/preflight.js +1 -0
  123. package/dist/host/profile-port.d.ts +4 -0
  124. package/dist/host/profile-port.js +4 -0
  125. package/dist/host/provision.d.ts +2 -2
  126. package/dist/host/provision.js +5 -3
  127. package/dist/host/recipe-rules.d.ts +5 -0
  128. package/dist/host/recipe-rules.js +382 -0
  129. package/dist/host/recipe.d.ts +14 -0
  130. package/dist/host/recipe.js +283 -0
  131. package/dist/host/shell-text.d.ts +9 -2
  132. package/dist/host/shell-text.js +15 -3
  133. package/dist/host/shell.d.ts +2 -0
  134. package/dist/host/shell.js +7 -0
  135. package/dist/host/spec.d.ts +8 -0
  136. package/dist/host/spec.js +24 -0
  137. package/dist/host/supply-index.d.ts +34 -0
  138. package/dist/host/supply-index.js +202 -0
  139. package/dist/host/supply-port.d.ts +5 -0
  140. package/dist/host/supply-port.js +39 -0
  141. package/dist/host/time.d.ts +12 -0
  142. package/dist/host/time.js +19 -0
  143. package/dist/host/tokens.d.ts +26 -0
  144. package/dist/host/tokens.js +154 -0
  145. package/dist/host/tool-kit.js +1 -1
  146. package/dist/host/unit-face.d.ts +5 -4
  147. package/dist/host/version-range.d.ts +2 -0
  148. package/dist/host/version-range.js +73 -0
  149. package/dist/host/version.d.ts +3 -0
  150. package/dist/host/version.js +29 -0
  151. package/dist/host.d.ts +47 -16
  152. package/dist/host.js +47 -16
  153. package/dist/i18n/en.js +224 -71
  154. package/dist/i18n/index.d.ts +298 -73
  155. package/dist/i18n/merge.js +1 -1
  156. package/dist/i18n/need-text.d.ts +26 -0
  157. package/dist/i18n/need-text.js +26 -0
  158. package/dist/i18n/settings.d.ts +70 -0
  159. package/dist/i18n/settings.js +136 -0
  160. package/dist/i18n/zh.d.ts +297 -72
  161. package/dist/i18n/zh.js +226 -73
  162. package/dist/index.d.ts +23 -7
  163. package/dist/index.js +23 -7
  164. package/dist/{api → lib}/dsh-client.d.ts +11 -1
  165. package/dist/lib/dsh-client.js +1 -0
  166. package/dist/lib/market-index.d.ts +7 -0
  167. package/dist/lib/market-index.js +25 -0
  168. package/dist/lib/react.d.ts +0 -40
  169. package/dist/lib/react.js +0 -36
  170. package/dist/lib/ui.js +3 -9
  171. package/dist/testing/data.d.ts +13 -0
  172. package/dist/testing/data.js +46 -0
  173. package/dist/testing/declaration.d.ts +1 -1
  174. package/dist/testing/declaration.js +1 -1
  175. package/dist/testing/host-fakes.d.ts +0 -13
  176. package/dist/testing/host-fakes.js +0 -24
  177. package/dist/testing/needs.d.ts +16 -0
  178. package/dist/testing/needs.js +46 -0
  179. package/dist/testing.d.ts +2 -0
  180. package/dist/testing.js +2 -0
  181. package/package.json +18 -2
  182. package/src/api/__tests__/blocker-table.test.ts +135 -86
  183. package/src/api/blocker-table.ts +52 -26
  184. package/src/api/dsh.ts +1 -1
  185. package/src/api/host-write.ts +0 -1
  186. package/src/api/workbench-client.test.ts +2 -2
  187. package/src/api/workbench-client.ts +2 -1
  188. package/src/components/Activity.css +0 -1
  189. package/src/components/ApprovalDetail.css +1 -2
  190. package/src/components/ApprovalDetail.tsx +1 -1
  191. package/src/components/ApprovalPlan.css +0 -1
  192. package/src/components/Card.css +0 -1
  193. package/src/components/Card.tsx +1 -1
  194. package/src/components/CardAnchor.test.tsx +1 -1
  195. package/src/components/CardBoundary.tsx +1 -1
  196. package/src/components/CardHead.css +0 -1
  197. package/src/components/CardHead.tsx +1 -1
  198. package/src/components/ChoiceGroup.css +1 -2
  199. package/src/components/ConfirmBar.tsx +1 -1
  200. package/src/components/Form.css +1 -1
  201. package/src/components/Form.tsx +1 -1
  202. package/src/components/FormActions.tsx +1 -1
  203. package/src/components/LongTaskRow.css +1 -2
  204. package/src/components/LongTaskRow.tsx +1 -1
  205. package/src/components/Note.css +0 -1
  206. package/src/components/ResourceStates.css +0 -1
  207. package/src/components/SelectFieldNodes.tsx +0 -1
  208. package/src/components/SettingsSection.css +0 -1
  209. package/src/components/Spinner.css +0 -1
  210. package/src/components/Stack.css +0 -1
  211. package/src/components/StateBlock.css +0 -1
  212. package/src/components/__tests__/long-task-row.test.ts +1 -1
  213. package/src/components/board-module.ts +3 -3
  214. package/src/components/icons.tsx +16 -8
  215. package/src/config/constants.ts +2 -2
  216. package/src/{api → contract}/__tests__/facts.test.ts +73 -25
  217. package/src/{api → contract}/__tests__/long-task.test.ts +3 -3
  218. package/src/contract/__tests__/needs.test.ts +74 -0
  219. package/src/{host → contract}/__tests__/unit-declaration.test.ts +1 -1
  220. package/src/contract/__tests__/unit.test.ts +43 -0
  221. package/src/contract/adapters.ts +9 -0
  222. package/src/contract/cli.ts +3 -0
  223. package/src/contract/data.ts +145 -0
  224. package/src/{api → contract}/facts.ts +34 -4
  225. package/src/contract/needs.ts +331 -0
  226. package/src/contract/plugin-source.ts +1 -0
  227. package/src/contract/protocol/bundle-install.ts +198 -0
  228. package/src/contract/protocol/config-sync.ts +65 -0
  229. package/src/contract/protocol/diy.ts +4 -0
  230. package/src/contract/protocol/dsh-plugins.ts +13 -0
  231. package/src/contract/protocol/long-tasks.ts +16 -0
  232. package/src/contract/protocol/market-index.ts +246 -0
  233. package/src/contract/protocol/platform.ts +47 -0
  234. package/src/contract/protocol/preflight-wake.ts +17 -0
  235. package/src/contract/protocol/profile-create.ts +36 -0
  236. package/src/contract/protocol/sidebar-edition.ts +19 -0
  237. package/src/contract/protocol/unit-manifests.ts +8 -0
  238. package/src/{api → contract}/unit-board.ts +0 -1
  239. package/src/contract/unit-capability.ts +37 -0
  240. package/src/{host → contract}/unit-declaration.ts +22 -18
  241. package/src/contract/unit.ts +76 -0
  242. package/src/contract/workbench-contract.ts +30 -0
  243. package/src/host/__tests__/adapter-set.test.ts +228 -0
  244. package/src/host/__tests__/adapters.test.ts +27 -0
  245. package/src/host/__tests__/changelog.test.ts +102 -0
  246. package/src/host/__tests__/command-name.test.ts +16 -0
  247. package/src/host/__tests__/diy-record.test.ts +3 -3
  248. package/src/host/__tests__/facts.test.ts +5 -5
  249. package/src/host/__tests__/long-task.test.ts +1 -1
  250. package/src/host/__tests__/market-index.test.ts +179 -0
  251. package/src/host/__tests__/plugin-ledger.test.ts +10 -10
  252. package/src/host/__tests__/provision.test.ts +7 -6
  253. package/src/host/__tests__/shell-text.test.ts +16 -1
  254. package/src/host/__tests__/supply-index.test.ts +137 -0
  255. package/src/host/__tests__/tokens.test.ts +110 -0
  256. package/src/host/__tests__/version-range.test.ts +21 -0
  257. package/src/host/adapter-set.ts +298 -0
  258. package/src/host/adapter-types.ts +105 -0
  259. package/src/host/adapters.ts +44 -0
  260. package/src/host/browser.ts +3 -0
  261. package/src/host/changelog.ts +212 -0
  262. package/src/host/channel-plugin.ts +55 -0
  263. package/src/host/cli.ts +11 -0
  264. package/src/host/command-name.ts +15 -0
  265. package/src/host/data-error.ts +21 -0
  266. package/src/host/data-root.ts +2 -0
  267. package/src/host/diy-debug.ts +2 -1
  268. package/src/host/diy-record.ts +2 -1
  269. package/src/host/facts.ts +4 -3
  270. package/src/host/git.ts +2 -2
  271. package/src/host/http.ts +1 -1
  272. package/src/host/lib-capabilities.ts +52 -0
  273. package/src/host/lib-install.ts +18 -0
  274. package/src/host/long-task.ts +4 -3
  275. package/src/host/market-index.ts +413 -0
  276. package/src/host/needs.ts +6 -0
  277. package/src/host/patch.ts +93 -0
  278. package/src/host/paths.ts +37 -0
  279. package/src/host/platform.ts +48 -0
  280. package/src/host/plugin-source.ts +48 -56
  281. package/src/host/plugin.ts +39 -0
  282. package/src/host/port-types.ts +222 -0
  283. package/src/host/preflight.ts +31 -0
  284. package/src/host/profile-port.ts +9 -0
  285. package/src/host/provision.ts +7 -4
  286. package/src/host/recipe-rules.ts +330 -0
  287. package/src/host/recipe.test.ts +334 -0
  288. package/src/host/recipe.ts +323 -0
  289. package/src/host/shell-text.ts +15 -3
  290. package/src/host/shell.ts +9 -0
  291. package/src/host/spec.ts +32 -0
  292. package/src/host/supply-index.ts +256 -0
  293. package/src/host/supply-port.ts +45 -0
  294. package/src/host/time.ts +22 -0
  295. package/src/host/tokens.ts +186 -0
  296. package/src/host/tool-kit.ts +1 -1
  297. package/src/host/unit-face.ts +5 -4
  298. package/src/host/version-range.ts +71 -0
  299. package/src/host/version.ts +30 -0
  300. package/src/host.ts +47 -16
  301. package/src/i18n/en.ts +224 -71
  302. package/src/i18n/merge.test.ts +6 -6
  303. package/src/i18n/merge.ts +1 -1
  304. package/src/i18n/need-text.ts +27 -0
  305. package/src/i18n/settings.ts +141 -0
  306. package/src/i18n/zh.ts +227 -73
  307. package/src/index.ts +23 -7
  308. package/src/lib/blocker-action.ts +0 -1
  309. package/src/{api → lib}/dsh-client.ts +12 -1
  310. package/src/lib/market-index.ts +36 -0
  311. package/src/lib/react.ts +0 -40
  312. package/src/lib/text.test.ts +2 -2
  313. package/src/lib/ui.test.ts +6 -5
  314. package/src/lib/ui.ts +3 -9
  315. package/src/testing/__tests__/declaration.test.ts +1 -1
  316. package/src/testing/data.ts +66 -0
  317. package/src/testing/declaration.ts +2 -2
  318. package/src/testing/host-fakes.ts +0 -38
  319. package/src/testing/needs.ts +80 -0
  320. package/src/testing.ts +2 -0
  321. package/dist/api/unit-declaration.d.ts +0 -65
  322. package/dist/api/unit.d.ts +0 -85
  323. package/dist/api/unit.js +0 -8
  324. package/dist/api/workbench-contract.d.ts +0 -44
  325. package/dist/components/MockStrip.css +0 -39
  326. package/dist/components/MockStrip.d.ts +0 -15
  327. package/dist/components/MockStrip.js +0 -8
  328. package/dist/components/SaveBar.css +0 -7
  329. package/dist/host/browser-find.d.ts +0 -38
  330. package/dist/host/browser-find.js +0 -242
  331. package/dist/host/browser-read.d.ts +0 -28
  332. package/dist/host/browser-read.js +0 -243
  333. package/dist/host/opencli-runtime.d.ts +0 -25
  334. package/dist/host/opencli-runtime.js +0 -56
  335. package/dist/host/opencli-window.d.ts +0 -2
  336. package/dist/host/opencli-window.js +0 -8
  337. package/dist/host/opencli.d.ts +0 -37
  338. package/dist/host/opencli.js +0 -155
  339. package/dist/host/unit-declaration.js +0 -213
  340. package/dist/host/unit-libs.d.ts +0 -37
  341. package/dist/lib/diy-debug.d.ts +0 -80
  342. package/dist/lib/diy-debug.js +0 -88
  343. package/dist/lib/diy-record.d.ts +0 -135
  344. package/dist/lib/diy-record.js +0 -162
  345. package/dist/lib/lint-probe.d.ts +0 -1
  346. package/dist/lib/lint-probe.js +0 -6
  347. package/dist/lib/panel-state.d.ts +0 -120
  348. package/dist/lib/panel-state.js +0 -176
  349. package/src/api/__tests__/unit.test.ts +0 -38
  350. package/src/api/unit.ts +0 -93
  351. package/src/api/workbench-contract.ts +0 -59
  352. package/src/host/__tests__/browser-find.test.ts +0 -330
  353. package/src/host/__tests__/browser-read.test.ts +0 -228
  354. package/src/host/__tests__/opencli-runtime.test.ts +0 -46
  355. package/src/host/browser-find.ts +0 -311
  356. package/src/host/browser-read.ts +0 -311
  357. package/src/host/opencli-runtime.ts +0 -79
  358. package/src/host/opencli-window.ts +0 -11
  359. package/src/host/opencli.ts +0 -213
  360. package/src/host/unit-libs.ts +0 -41
  361. /package/dist/{api/blocker.js → contract/adapters.js} +0 -0
  362. /package/dist/{api → contract}/blocker.d.ts +0 -0
  363. /package/dist/{api/dsh-client.js → contract/blocker.js} +0 -0
  364. /package/dist/{api/unit-board.js → contract/cli.js} +0 -0
  365. /package/dist/{api/workbench-contract.js → contract/data.js} +0 -0
  366. /package/dist/{api → contract}/long-task.d.ts +0 -0
  367. /package/dist/{api → contract}/long-task.js +0 -0
  368. /package/dist/{host/unit-libs.js → contract/plugin-source.js} +0 -0
  369. /package/dist/{api → contract}/unit-board.d.ts +0 -0
  370. /package/src/{api → contract}/blocker.ts +0 -0
  371. /package/src/{api → contract}/long-task.ts +0 -0
@@ -1,13 +1,14 @@
1
+ import { needsProblemsOf } from './needs.js';
1
2
  /**
2
3
  * 声明协议当前版本;模块清单的 dsh.workbench.apiVersion 要写这个整数。
3
4
  */
4
- export const WORKBENCH_API_VERSION = 1;
5
+ export const WORKBENCH_API_VERSION = 2;
5
6
  /**
6
7
  * 外壳愿意认的协议版本;不在表里的模块当场被拒,不猜语义。
7
8
  */
8
9
  export const SUPPORTED_API_VERSIONS = [WORKBENCH_API_VERSION];
9
10
  /**
10
- * 协议认得的全部键;写了别的键不会被采纳(外壳静默忽略),所以字段名拼错不会有提示。
11
+ * 协议认得的全部键;写了别的键这份清单会被拒(`protocol` 判据与运行时同一套),拼错当场报出来。
11
12
  */
12
13
  export const DECLARATION_KEYS = [
13
14
  'apiVersion',
@@ -15,10 +16,10 @@ export const DECLARATION_KEYS = [
15
16
  'card',
16
17
  'tools',
17
18
  'host',
18
- 'env',
19
+ 'needs',
19
20
  ];
20
21
  /**
21
- * 协议要求必写的键;env 不在其中(没有环境需要就不写)。
22
+ * 协议要求必写的键;needs 不在其中(没有环境需要就不写)。
22
23
  */
23
24
  export const DECLARATION_REQUIRED_KEYS = [
24
25
  'apiVersion',
@@ -61,20 +62,25 @@ export function declarationProblemsOf(subject, raw) {
61
62
  if (version === undefined) {
62
63
  return [
63
64
  `${subject}: dsh.workbench 没有 apiVersion —— 协议从 v${WORKBENCH_API_VERSION} 起,` +
64
- `写 \`"apiVersion": ${WORKBENCH_API_VERSION}\`。缺它 = 外壳不认这个模块(ADR-0038 §2.3)`,
65
+ `写 \`"apiVersion": ${WORKBENCH_API_VERSION}\`。缺它 = 外壳不认这个模块`,
65
66
  ];
66
67
  }
67
68
  if (!Number.isInteger(version) || !SUPPORTED_API_VERSIONS.includes(version)) {
69
+ const hint = version === 1
70
+ ? ` —— v2 把 \`env\` 的三张表(command / plugins / libs)换成了 \`needs\`:` +
71
+ '把外部需要逐条写成 `{ kind, name, purpose, ... }`(kind 是 bin / extension / lib / env),' +
72
+ '再把 apiVersion 改成 2'
73
+ : '';
68
74
  return [
69
75
  `${subject}: dsh.workbench.apiVersion 是 ${JSON.stringify(version)},这里只认 ` +
70
- `${SUPPORTED_API_VERSIONS.join(' / ')}(要整数)`,
76
+ `${SUPPORTED_API_VERSIONS.join(' / ')}(要整数)${hint}`,
71
77
  ];
72
78
  }
73
79
  const problems = [];
74
80
  const unknown = outsideKeys(raw, DECLARATION_KEYS);
75
81
  if (unknown.length > 0) {
76
82
  problems.push(`${subject}: dsh.workbench 里有协议 v${WORKBENCH_API_VERSION} 不认识的键 ${listOf(unknown)} —— ` +
77
- `只有 ${listOf(DECLARATION_KEYS)}。(拼错的键会被外壳**静默忽略**:那句声明等于没写)`);
83
+ `只有 ${listOf(DECLARATION_KEYS)}。(协议外的键会让这份清单被拒:那句声明等于没写)`);
78
84
  }
79
85
  for (const key of DECLARATION_REQUIRED_KEYS) {
80
86
  if (raw[key] === undefined) {
@@ -170,10 +176,6 @@ export function declarationProblemsOf(subject, raw) {
170
176
  }
171
177
  }
172
178
  }
173
- if (raw.env !== undefined && !isRecord(raw.env)) {
174
- problems.push(`${subject}: dsh.workbench.env 要是对象(command / plugins / libs)—— ` +
175
- `语义由门禁的 env 判据查,这里只查形状`);
176
- }
177
179
  return problems;
178
180
  }
179
181
  /**
@@ -185,8 +187,11 @@ export function declarationProblemsOf(subject, raw) {
185
187
  export function readDeclaration(subject, raw) {
186
188
  const problems = declarationProblemsOf(subject, raw);
187
189
  if (problems.length > 0)
188
- return { problems };
190
+ return { problems, warnings: [] };
189
191
  const declaration = raw;
192
+ const needsRead = needsProblemsOf(subject, declaration.needs);
193
+ if (needsRead.errors.length > 0)
194
+ return { problems: needsRead.errors, warnings: needsRead.warnings };
190
195
  const card = declaration.card;
191
196
  return {
192
197
  declaration,
@@ -207,7 +212,8 @@ export function readDeclaration(subject, raw) {
207
212
  inject: [...(declaration.host.inject ?? [])],
208
213
  ...(declaration.host.optional === undefined ? {} : { optional: [...declaration.host.optional] }),
209
214
  },
210
- ...(declaration.env === undefined ? {} : { env: declaration.env }),
215
+ ...(declaration.needs === undefined ? {} : { needs: declaration.needs }),
211
216
  },
217
+ warnings: needsRead.warnings,
212
218
  };
213
219
  }
@@ -0,0 +1,57 @@
1
+ import type { ExtensionNeed, LibNeed, Need } from './needs.js';
2
+ /**
3
+ * 一张卡片在清单里的静态声明(文案键加排序位);默认显不显示由运行期面板配置定。
4
+ */
5
+ export interface UnitCard {
6
+ readonly titleKey: string;
7
+ readonly order: number;
8
+ }
9
+ /**
10
+ * 一条工具在清单里的样子:全名加会不会写;审批按 writes 认领。
11
+ */
12
+ export interface UnitTool {
13
+ readonly name: string;
14
+ readonly writes: boolean;
15
+ }
16
+ /**
17
+ * 模块要外壳的哪些服务:inject 缺一个就挂不上,optional 缺了照挂。
18
+ */
19
+ export interface UnitHostNeeds {
20
+ readonly inject: readonly string[];
21
+ readonly optional?: readonly string[];
22
+ }
23
+ /**
24
+ * 已装插件与源上最新版那一对,用来判该不该提示升级;latest 缺省表示还没查到。
25
+ */
26
+ export interface PluginRelease {
27
+ readonly installed: string;
28
+ readonly latest?: string;
29
+ }
30
+ /**
31
+ * 装配期用的模块清单:单元 id、卡片、工具、宿主服务与环境需要,比声明少一层协议包装。
32
+ */
33
+ export interface UnitManifest {
34
+ readonly id: string;
35
+ readonly card: UnitCard | null;
36
+ readonly tools: readonly UnitTool[];
37
+ readonly host: UnitHostNeeds;
38
+ readonly needs?: readonly Need[];
39
+ }
40
+ /**
41
+ * 模块声明的全部环境需要(没写就是空表)。
42
+ * @param manifest 模块清单。
43
+ * @returns need 列表。
44
+ */
45
+ export declare function needsOf(manifest: UnitManifest): readonly Need[];
46
+ /**
47
+ * 宿主能代装的那些需要:只有写了 `sources` 的 extension / lib 算。
48
+ * @param manifest 模块清单。
49
+ * @returns 可代装的 need 列表。
50
+ */
51
+ export declare function provisionableNeedsOf(manifest: UnitManifest): readonly (ExtensionNeed | LibNeed)[];
52
+ /**
53
+ * 市场门槛要看的那些需要:声明了 extension / lib 就算(不要求写了来源)。
54
+ * @param manifest 模块清单。
55
+ * @returns extension / lib 的 need 列表。
56
+ */
57
+ export declare function supplyNeedsOf(manifest: UnitManifest): readonly (ExtensionNeed | LibNeed)[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 模块声明的全部环境需要(没写就是空表)。
3
+ * @param manifest 模块清单。
4
+ * @returns need 列表。
5
+ */
6
+ export function needsOf(manifest) {
7
+ return manifest.needs ?? [];
8
+ }
9
+ /**
10
+ * 宿主能代装的那些需要:只有写了 `sources` 的 extension / lib 算。
11
+ * @param manifest 模块清单。
12
+ * @returns 可代装的 need 列表。
13
+ */
14
+ export function provisionableNeedsOf(manifest) {
15
+ return needsOf(manifest).filter((need) => (need.kind === 'extension' || need.kind === 'lib') && (need.sources ?? []).length > 0);
16
+ }
17
+ /**
18
+ * 市场门槛要看的那些需要:声明了 extension / lib 就算(不要求写了来源)。
19
+ * @param manifest 模块清单。
20
+ * @returns extension / lib 的 need 列表。
21
+ */
22
+ export function supplyNeedsOf(manifest) {
23
+ return needsOf(manifest).filter((need) => need.kind === 'extension' || need.kind === 'lib');
24
+ }
@@ -0,0 +1,15 @@
1
+ import type { NeedState } from '../contract/unit-capability.js';
2
+ /**
3
+ * 供给动作的那几档(装 / 升 / 卸,模块、共用依赖与插件各一套);写口按它分派。
4
+ */
5
+ export type ProvisionAction = 'install' | 'update' | 'uninstall' | 'update-dependency' | 'install-bundle' | 'install-version' | 'update-bundle' | 'remove-bundle' | 'cancel-install' | 'update-plugin' | 'uninstall-plugin' | 'update-workbench';
6
+ /**
7
+ * 宿主对「这个单元现在能不能用」的那份读数:状态汇总加逐条 need 的细节。
8
+ */
9
+ export interface CapabilityPayload {
10
+ readonly unit: string;
11
+ readonly status: 'ok' | 'degraded' | 'missing' | 'outdated' | 'unchecked' | 'unsupported' | 'failed';
12
+ readonly needs: readonly NeedState[];
13
+ readonly detail?: string;
14
+ readonly released?: boolean;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import { type AdapterSet, type CoreAdapterSet } from './adapters.js';
3
+ export interface WorkbenchConfig {
4
+ readonly adapterSet?: string;
5
+ }
6
+ export type AdapterSetFailure = 'not-configured' | 'no-profile' | 'malformed' | 'not-resolvable' | 'import-failed' | 'bad-export' | 'factory-failed' | 'incompatible-version' | 'missing-member';
7
+ export type AdapterSetLoad = {
8
+ readonly ok: true;
9
+ readonly spec: string;
10
+ readonly set: CoreAdapterSet;
11
+ } | {
12
+ readonly ok: false;
13
+ readonly spec?: string;
14
+ readonly failure: AdapterSetFailure;
15
+ readonly detail: string;
16
+ readonly cause?: unknown;
17
+ };
18
+ export declare function validateAdapterSet(value: unknown, spec: string): AdapterSetLoad;
19
+ export declare function loadAdapterSet(ctx: DshHostContext, spec: string | undefined): Promise<AdapterSetLoad>;
20
+ export declare function withDefaultAdapterSet(defaults: AdapterSet, loaded: AdapterSetLoad): AdapterSet;
21
+ export declare function resolveAdapterSet(ctx: DshHostContext, spec: string | undefined, makeDefaults: () => Promise<AdapterSet>): Promise<{
22
+ readonly set: AdapterSet;
23
+ readonly load: AdapterSetLoad;
24
+ readonly usedDefaults: boolean;
25
+ }>;
26
+ export type { AdapterSet, CoreAdapterSet };
@@ -0,0 +1,243 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+ import { ADAPTER_SET_API_VERSION, SUPPORTED_ADAPTER_API_VERSIONS, } from './adapters.js';
6
+ import { isPackageName } from './spec.js';
7
+ const CORE_MEMBERS = ['data', 'supply', 'profile', 'probe'];
8
+ const CORE_METHODS = [
9
+ ['data', 'read'],
10
+ ['data', 'request'],
11
+ ['data', 'requestMany'],
12
+ ['data', 'submit'],
13
+ ['supply', 'resolvePluginSource'],
14
+ ['supply', 'libInstallCommand'],
15
+ ['supply', 'pluginInstallPlan'],
16
+ ['supply', 'latestVersion'],
17
+ ['supply', 'missingReleaseParts'],
18
+ ['supply', 'probeRelease'],
19
+ ['supply', 'splitNpmSpec'],
20
+ ['profile', 'dirOf'],
21
+ ['profile', 'dshPlugins'],
22
+ ['profile', 'selfUpdateView'],
23
+ ['probe', 'probeUnits'],
24
+ ['probe', 'registerPreflight'],
25
+ ['probe', 'declaredPluginCommands'],
26
+ ];
27
+ const FULL_MEMBERS = ['modules', 'runtime', 'plugins', 'actions'];
28
+ const FULL_METHODS = [
29
+ ['modules', 'isolatedHome'],
30
+ ['modules', 'cliCatalogPath'],
31
+ ['modules', 'vendorPluginsDir'],
32
+ ['modules', 'opencliInstallCommand'],
33
+ ['modules', 'profileDirOf'],
34
+ ['modules', 'profileModules'],
35
+ ['modules', 'readInstalledModule'],
36
+ ['modules', 'readProfilePackage'],
37
+ ['modules', 'readBundleManager'],
38
+ ['modules', 'createRegistryNotebook'],
39
+ ['modules', 'declarationGaps'],
40
+ ['modules', 'moduleDeclarationOf'],
41
+ ['modules', 'registryDeclarationOf'],
42
+ ['modules', 'pathDeclarationOf'],
43
+ ['modules', 'declarationRefusalOf'],
44
+ ['modules', 'refusalReason'],
45
+ ['modules', 'packageRouteOf'],
46
+ ['modules', 'isNewerVersion'],
47
+ ['modules', 'startSelfUpdate'],
48
+ ['runtime', 'packageRoot'],
49
+ ['runtime', 'opencliCommand'],
50
+ ['runtime', 'seed'],
51
+ ['runtime', 'warnUnwritableRoot'],
52
+ ['plugins', 'declarationLookup'],
53
+ ['plugins', 'createUnits'],
54
+ ['actions', 'configSyncHandler'],
55
+ ['actions', 'profileCreateHandler'],
56
+ ['actions', 'configSyncAction'],
57
+ ['actions', 'profileCreateAction'],
58
+ ];
59
+ function methodOf(value, member, method) {
60
+ const part = value[member];
61
+ if (typeof part !== 'object' || part === null)
62
+ return undefined;
63
+ return part[method];
64
+ }
65
+ function failure(failureKind, detail, spec, cause) {
66
+ return {
67
+ ok: false,
68
+ ...(spec === undefined ? {} : { spec }),
69
+ failure: failureKind,
70
+ detail,
71
+ ...(cause === undefined ? {} : { cause }),
72
+ };
73
+ }
74
+ function profileDirOf(ctx) {
75
+ const profile = ctx.get('profileContext');
76
+ const dir = typeof profile?.dir === 'string' ? profile.dir.trim() : '';
77
+ return dir === '' ? null : dir;
78
+ }
79
+ function packageDirOf(spec, from) {
80
+ let dir = from;
81
+ for (;;) {
82
+ const candidate = join(dir, 'node_modules', spec);
83
+ if (existsSync(join(candidate, 'package.json')))
84
+ return candidate;
85
+ const up = dirname(dir);
86
+ if (up === dir)
87
+ return undefined;
88
+ dir = up;
89
+ }
90
+ }
91
+ function entryOf(value) {
92
+ if (typeof value === 'string')
93
+ return value;
94
+ if (typeof value !== 'object' || value === null)
95
+ return undefined;
96
+ const record = value;
97
+ for (const key of ['import', 'node', 'module', 'default', 'require']) {
98
+ const found = entryOf(record[key]);
99
+ if (found !== undefined)
100
+ return found;
101
+ }
102
+ return undefined;
103
+ }
104
+ function exportsEntryOf(value) {
105
+ if (typeof value !== 'object' || value === null)
106
+ return entryOf(value);
107
+ const record = value;
108
+ return '.' in record ? entryOf(record['.']) : entryOf(record);
109
+ }
110
+ function esmEntryUrl(spec, profileDir) {
111
+ const dir = packageDirOf(spec, profileDir);
112
+ if (dir === undefined)
113
+ return undefined;
114
+ let pkg;
115
+ try {
116
+ pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
117
+ }
118
+ catch {
119
+ return undefined;
120
+ }
121
+ const main = typeof pkg['main'] === 'string' ? pkg['main'] : undefined;
122
+ const module = typeof pkg['module'] === 'string' ? pkg['module'] : undefined;
123
+ const entry = exportsEntryOf(pkg['exports']) ?? module ?? main ?? 'index.js';
124
+ const file = join(dir, entry);
125
+ return existsSync(file) ? pathToFileURL(file).href : undefined;
126
+ }
127
+ function resolveFromProfile(spec, profileDir) {
128
+ const esm = esmEntryUrl(spec, profileDir);
129
+ if (esm !== undefined)
130
+ return esm;
131
+ const parent = pathToFileURL(join(profileDir, 'package.json')).href;
132
+ try {
133
+ return pathToFileURL(createRequire(parent).resolve(spec)).href;
134
+ }
135
+ catch {
136
+ return undefined;
137
+ }
138
+ }
139
+ function versionOf(value) {
140
+ const version = value['apiVersion'];
141
+ return typeof version === 'number' && Number.isInteger(version) ? version : undefined;
142
+ }
143
+ export function validateAdapterSet(value, spec) {
144
+ if (typeof value !== 'object' || value === null) {
145
+ return failure('missing-member', `${spec} 的 createAdapterSet(ctx) 没回一个对象`, spec);
146
+ }
147
+ const record = value;
148
+ const version = versionOf(record);
149
+ if (version === undefined || !SUPPORTED_ADAPTER_API_VERSIONS.includes(version)) {
150
+ return failure('incompatible-version', `${spec} 的适配器协议版本是 ${String(record['apiVersion'])},工作台只认 v${ADAPTER_SET_API_VERSION}`, spec);
151
+ }
152
+ const missing = CORE_MEMBERS.filter((member) => record[member] === undefined || record[member] === null);
153
+ for (const [member, method] of CORE_METHODS) {
154
+ if (typeof methodOf(record, member, method) !== 'function')
155
+ missing.push(`${member}.${method}`);
156
+ }
157
+ if (typeof record['id'] !== 'string' || record['id'].trim() === '')
158
+ missing.push('id');
159
+ if (typeof record['version'] !== 'string' || record['version'].trim() === '')
160
+ missing.push('version');
161
+ if (FULL_MEMBERS.some((member) => record[member] !== undefined)) {
162
+ for (const member of FULL_MEMBERS) {
163
+ if (typeof record[member] !== 'object' || record[member] === null)
164
+ missing.push(member);
165
+ }
166
+ for (const [member, method] of FULL_METHODS) {
167
+ if (typeof methodOf(record, member, method) !== 'function')
168
+ missing.push(`${member}.${method}`);
169
+ }
170
+ }
171
+ if (missing.length > 0) {
172
+ return failure('missing-member', `${spec} 少了 ${missing.join(' / ')}`, spec);
173
+ }
174
+ return { ok: true, spec, set: record };
175
+ }
176
+ export async function loadAdapterSet(ctx, spec) {
177
+ const wanted = typeof spec === 'string' ? spec.trim() : spec === undefined ? '' : String(spec).trim();
178
+ if (wanted === '')
179
+ return failure('not-configured', '没有配置 adapterSet');
180
+ const profileDir = profileDirOf(ctx);
181
+ if (profileDir === null)
182
+ return failure('no-profile', '找不到 profile 目录,无法从 profile 解析适配器集合', wanted);
183
+ if (!isPackageName(wanted)) {
184
+ return failure('malformed', `适配器集合要写包名(如 @acme/adapters-set),收到 ${JSON.stringify(wanted)}`, wanted);
185
+ }
186
+ const url = resolveFromProfile(wanted, profileDir);
187
+ if (url === undefined) {
188
+ return failure('not-resolvable', `在 profile 里解析不到 ${wanted},先把它装进这个 profile`, wanted);
189
+ }
190
+ let mod;
191
+ try {
192
+ mod = (await import(url));
193
+ }
194
+ catch (error) {
195
+ return failure('import-failed', `${wanted} 的入口没加载成:${String(error)}`, wanted, error);
196
+ }
197
+ const factory = mod['createAdapterSet'] ?? mod['default'];
198
+ if (typeof factory !== 'function') {
199
+ return failure('bad-export', `${wanted} 没导出 createAdapterSet(ctx),导出键:${Object.keys(mod).join(', ')}`, wanted);
200
+ }
201
+ let value;
202
+ try {
203
+ const raw = await factory(ctx);
204
+ if (typeof raw !== 'object' || raw === null) {
205
+ return failure('missing-member', `${wanted} 的 createAdapterSet(ctx) 没回一个对象`, wanted);
206
+ }
207
+ value = raw;
208
+ }
209
+ catch (error) {
210
+ return failure('factory-failed', `${wanted} 的 createAdapterSet(ctx) 抛了:${String(error)}`, wanted, error);
211
+ }
212
+ return validateAdapterSet(value, wanted);
213
+ }
214
+ export function withDefaultAdapterSet(defaults, loaded) {
215
+ if (!loaded.ok)
216
+ return defaults;
217
+ const set = loaded.set;
218
+ return {
219
+ apiVersion: set.apiVersion ?? defaults.apiVersion,
220
+ id: set.id ?? defaults.id,
221
+ version: set.version ?? defaults.version,
222
+ data: set.data ?? defaults.data,
223
+ supply: set.supply ?? defaults.supply,
224
+ modules: set.modules ?? defaults.modules,
225
+ profile: set.profile ?? defaults.profile,
226
+ probe: set.probe ?? defaults.probe,
227
+ runtime: set.runtime ?? defaults.runtime,
228
+ plugins: set.plugins ?? defaults.plugins,
229
+ actions: set.actions ?? defaults.actions,
230
+ };
231
+ }
232
+ function isFullAdapterSet(value) {
233
+ const candidate = value;
234
+ return ['modules', 'runtime', 'plugins', 'actions'].every((member) => typeof candidate[member] === 'object' && candidate[member] !== null);
235
+ }
236
+ export async function resolveAdapterSet(ctx, spec, makeDefaults) {
237
+ const load = await loadAdapterSet(ctx, spec);
238
+ if (load.ok && isFullAdapterSet(load.set)) {
239
+ return { set: load.set, load, usedDefaults: false };
240
+ }
241
+ const defaults = await makeDefaults();
242
+ return { set: withDefaultAdapterSet(defaults, load), load, usedDefaults: true };
243
+ }
@@ -0,0 +1,79 @@
1
+ import type { BundleCancellation, BundleChange, BundleInspection, BundleInstallRequest, BundleRegistries, BundleRegistry } from '../contract/protocol/bundle-install.js';
2
+ export type InstalledModule = {
3
+ readonly kind: 'module';
4
+ readonly pkg: string;
5
+ readonly unit: string;
6
+ readonly version: string;
7
+ readonly registry?: string;
8
+ readonly local?: boolean;
9
+ } | {
10
+ readonly kind: 'not-module';
11
+ readonly pkg: string;
12
+ } | {
13
+ readonly kind: 'unknown';
14
+ readonly pkg: string;
15
+ };
16
+ export interface ProfileModule {
17
+ readonly pkg: string;
18
+ readonly unit: string;
19
+ readonly version: string;
20
+ readonly registry?: string;
21
+ readonly local?: boolean;
22
+ }
23
+ export interface ProfilePackage {
24
+ readonly pkg: string;
25
+ readonly version: string;
26
+ readonly registry?: string;
27
+ readonly local?: boolean;
28
+ }
29
+ export interface BundleManager {
30
+ registries(): Promise<BundleRegistries | null>;
31
+ inspect(spec: string, registry?: BundleRegistry): Promise<BundleInspection | null>;
32
+ install(request: BundleInstallRequest): Promise<BundleChange | null>;
33
+ remove(name: string): Promise<BundleChange | null>;
34
+ setEnabled?(name: string, enabled: boolean): Promise<BundleChange | null>;
35
+ cancel(requestId: string): Promise<BundleCancellation | null>;
36
+ }
37
+ export interface RegistryEntry {
38
+ readonly scope: string;
39
+ readonly registry: string;
40
+ }
41
+ export interface RegistryNotebook {
42
+ sources(): readonly RegistryEntry[];
43
+ remember(entries: readonly RegistryEntry[]): readonly string[];
44
+ }
45
+ export interface SelfUpdatePaths {
46
+ readonly dir: string;
47
+ readonly script: string;
48
+ readonly marker: string;
49
+ readonly log: string;
50
+ }
51
+ export interface SelfUpdateRequest {
52
+ readonly dshHome: string;
53
+ readonly profile: string;
54
+ readonly pkg: string;
55
+ readonly from: string;
56
+ readonly to: string;
57
+ readonly pinned: boolean;
58
+ }
59
+ export interface SelfUpdateStart {
60
+ readonly started: boolean;
61
+ readonly paths: SelfUpdatePaths;
62
+ readonly forward: string;
63
+ }
64
+ export interface OpencliResolution {
65
+ readonly command: string;
66
+ readonly source: 'env' | 'isolated' | 'path';
67
+ readonly isolated: string | null;
68
+ }
69
+ export declare function scopeOf(pkg: string): string | null;
70
+ export declare function normalizeRegistry(url: string): string;
71
+ export declare function sameRegistry(a: string | null | undefined, b: string | null | undefined): boolean;
72
+ export declare function registryFailure(change: {
73
+ application?: string;
74
+ packageResult?: {
75
+ kind?: string;
76
+ output?: string;
77
+ };
78
+ errorDetail?: string;
79
+ }): boolean;
@@ -0,0 +1,23 @@
1
+ export function scopeOf(pkg) {
2
+ const slash = pkg.indexOf('/');
3
+ return pkg.startsWith('@') && slash > 1 ? pkg.slice(0, slash) : null;
4
+ }
5
+ export function normalizeRegistry(url) {
6
+ const trimmed = url.trim();
7
+ return trimmed.endsWith('/') ? trimmed : `${trimmed}/`;
8
+ }
9
+ export function sameRegistry(a, b) {
10
+ if (a === null || a === undefined || b === null || b === undefined)
11
+ return false;
12
+ if (a.trim() === '' || b.trim() === '')
13
+ return false;
14
+ return normalizeRegistry(a) === normalizeRegistry(b);
15
+ }
16
+ export function registryFailure(change) {
17
+ if (change.application !== 'failed')
18
+ return false;
19
+ if (change.packageResult?.kind === 'not-found')
20
+ return true;
21
+ const output = change.packageResult?.output ?? change.errorDetail ?? '';
22
+ return /ERR_PNPM_[A-Z_]*FETCH/.test(output);
23
+ }
@@ -0,0 +1,22 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import type { DataReader } from '../contract/data.js';
3
+ import type { EnvSupplyPort, HostActions, ModulePort, PluginSurface, ProbePort, ProfilePort, RuntimePort } from './port-types.js';
4
+ export declare const WORKBENCH_ADAPTERS = "workbenchAdapters";
5
+ export declare const ADAPTER_SET_API_VERSION = 1;
6
+ export declare const SUPPORTED_ADAPTER_API_VERSIONS: readonly number[];
7
+ export interface AdapterSet {
8
+ readonly apiVersion: number;
9
+ readonly id: string;
10
+ readonly version: string;
11
+ readonly data: DataReader;
12
+ readonly supply: EnvSupplyPort;
13
+ readonly modules: ModulePort;
14
+ readonly profile: ProfilePort;
15
+ readonly probe: ProbePort;
16
+ readonly runtime: RuntimePort;
17
+ readonly plugins: PluginSurface;
18
+ readonly actions: HostActions;
19
+ }
20
+ export type CoreAdapterSet = Pick<AdapterSet, 'apiVersion' | 'id' | 'version' | 'data' | 'supply' | 'profile' | 'probe'>;
21
+ export type WorkbenchAdapters = AdapterSet;
22
+ export declare function adaptersOf(ctx: DshHostContext): AdapterSet;
@@ -0,0 +1,9 @@
1
+ export const WORKBENCH_ADAPTERS = 'workbenchAdapters';
2
+ export const ADAPTER_SET_API_VERSION = 1;
3
+ export const SUPPORTED_ADAPTER_API_VERSIONS = [ADAPTER_SET_API_VERSION];
4
+ export function adaptersOf(ctx) {
5
+ const adapters = ctx.get(WORKBENCH_ADAPTERS, false);
6
+ if (adapters !== undefined)
7
+ return adapters;
8
+ throw new Error('workbenchAdapters 未提供');
9
+ }
@@ -0,0 +1,3 @@
1
+ export declare const BROWSER_SCREEN_SESSION = "workbench";
2
+ export declare const BROWSER_READ_SESSION = "workbench-read";
3
+ export declare const BROWSER_RECORD_SESSION = "workbench-rec";
@@ -0,0 +1,3 @@
1
+ export const BROWSER_SCREEN_SESSION = 'workbench';
2
+ export const BROWSER_READ_SESSION = 'workbench-read';
3
+ export const BROWSER_RECORD_SESSION = 'workbench-rec';
@@ -0,0 +1,21 @@
1
+ export declare const CHANGELOG_FILE = "CHANGELOG.md";
2
+ export declare const CHANGELOG_KINDS: readonly ["added", "changed", "fixed", "removed", "security", "deprecated"];
3
+ export type ChangelogKind = (typeof CHANGELOG_KINDS)[number];
4
+ export interface ChangelogSection {
5
+ readonly version: string;
6
+ readonly body: string;
7
+ }
8
+ export interface ChangelogEntryOptions {
9
+ readonly version: string;
10
+ readonly kind?: ChangelogKind | undefined;
11
+ readonly note: string;
12
+ readonly date?: string | undefined;
13
+ }
14
+ export declare function changelogVersion(value: string): string;
15
+ export declare function changelogDate(now?: Date): string;
16
+ export declare function normalizeChangelogText(text: string): string;
17
+ export declare function changelogSkeleton(): string;
18
+ export declare function parseChangelog(text: string): readonly ChangelogSection[];
19
+ export declare function changelogSectionOf(text: string, version: string): string | undefined;
20
+ export declare function changelogHasEntry(text: string, version: string): boolean;
21
+ export declare function appendChangelogEntry(text: string, options: ChangelogEntryOptions): string;