@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
@@ -0,0 +1,13 @@
1
+ export const DSH_PLUGINS_ROUTE = 'dsh-plugins';
2
+
3
+ export interface DshPluginRow {
4
+ readonly name: string;
5
+ readonly version: string;
6
+ readonly enabled: boolean;
7
+ }
8
+
9
+ export interface DshPluginsSnapshot {
10
+ readonly available: boolean;
11
+ readonly bundles: readonly DshPluginRow[];
12
+ readonly plugins: readonly DshPluginRow[];
13
+ }
@@ -0,0 +1,16 @@
1
+ import type { LongTaskStatus } from '../long-task.js';
2
+
3
+ export const LONG_TASKS_ROUTE = 'long-tasks';
4
+
5
+ export interface ShellLongTaskRow {
6
+ readonly unit: string;
7
+ readonly id: string;
8
+ readonly workspace: string;
9
+ readonly target: string;
10
+ readonly status: LongTaskStatus;
11
+ readonly session?: string | undefined;
12
+ }
13
+
14
+ export interface ShellLongTasksPayload {
15
+ readonly runs: readonly ShellLongTaskRow[];
16
+ }
@@ -0,0 +1,246 @@
1
+ export const MARKET_INDEX_FORMAT = 1;
2
+ export const MARKET_INDEX_PATH = 'market.json';
3
+ export const MARKET_DISCOVER_ROUTE = 'panels/market-discover';
4
+ export const MARKET_DOC_ROUTE = 'panels/market-doc';
5
+ export const MARKET_PUBLISH_PREVIEW_ROUTE = 'panels/market-publish-preview';
6
+ export const MARKET_SOURCES_RESOURCE = 'market-sources';
7
+ export const MARKET_WORKBENCH_LABEL = 'workbench';
8
+
9
+ export type MarketSourceKind = 'http' | 'git';
10
+
11
+ export type MarketSourcePolicy = 'artifacts-in-repo' | 'catalog-only';
12
+
13
+ export interface IndexSourceSpec {
14
+ readonly kind: MarketSourceKind;
15
+ readonly url: string;
16
+ readonly ref?: string;
17
+ readonly path?: string;
18
+ readonly localPath?: string;
19
+ }
20
+
21
+ export interface MarketSourceConfig extends IndexSourceSpec {
22
+ readonly id: string;
23
+ readonly label: string;
24
+ readonly policy?: MarketSourcePolicy;
25
+ }
26
+
27
+ export interface MarketLocalizedText {
28
+ readonly zh?: string;
29
+ readonly en?: string;
30
+ }
31
+
32
+ export interface MarketIndexNpmSource {
33
+ readonly type: 'npm';
34
+ readonly registry?: string;
35
+ }
36
+
37
+ export interface MarketIndexGitSource {
38
+ readonly type: 'git';
39
+ readonly url: string;
40
+ readonly commit: string;
41
+ readonly path?: string;
42
+ }
43
+
44
+ export type MarketIndexSource = MarketIndexNpmSource | MarketIndexGitSource;
45
+
46
+ export interface MarketIndexEngines {
47
+ readonly dsh?: string;
48
+ }
49
+
50
+ export interface MarketIndexVersion {
51
+ readonly version: string;
52
+ readonly publishTimestamp?: number;
53
+ readonly source: MarketIndexSource;
54
+ readonly engines?: MarketIndexEngines;
55
+ }
56
+
57
+ export interface MarketIndexEntryMetadata {
58
+ readonly category?: string;
59
+ readonly labels?: readonly string[];
60
+ readonly keywords?: readonly string[];
61
+ readonly sortKeys?: Readonly<Record<string, string | number>>;
62
+ }
63
+
64
+ export interface MarketIndexEntry {
65
+ readonly name: string;
66
+ readonly title?: MarketLocalizedText;
67
+ readonly description?: MarketLocalizedText;
68
+ readonly author?: string;
69
+ readonly homepage?: string;
70
+ readonly icon?: string;
71
+ readonly metadata?: MarketIndexEntryMetadata;
72
+ readonly versions: readonly MarketIndexVersion[];
73
+ }
74
+
75
+ export interface MarketIndexCategory {
76
+ readonly title?: MarketLocalizedText;
77
+ }
78
+
79
+ export interface MarketIndexLabel {
80
+ readonly title?: MarketLocalizedText;
81
+ }
82
+
83
+ export interface MarketIndexSortKey {
84
+ readonly title?: MarketLocalizedText;
85
+ readonly order?: 'asc' | 'desc';
86
+ }
87
+
88
+ export interface MarketIndexMetadata {
89
+ readonly categories?: Readonly<Record<string, MarketIndexCategory>>;
90
+ readonly labels?: Readonly<Record<string, MarketIndexLabel>>;
91
+ readonly sortKeys?: Readonly<Record<string, MarketIndexSortKey>>;
92
+ }
93
+
94
+ export interface MarketIndex {
95
+ readonly format: 1;
96
+ readonly title?: MarketLocalizedText;
97
+ readonly description?: MarketLocalizedText;
98
+ readonly metadata?: MarketIndexMetadata;
99
+ readonly plugins: readonly MarketIndexEntry[];
100
+ }
101
+
102
+ export type MarketIndexProblemKind =
103
+ | 'not-json'
104
+ | 'not-object'
105
+ | 'format'
106
+ | 'plugins'
107
+ | 'plugin'
108
+ | 'name'
109
+ | 'duplicate-name'
110
+ | 'versions'
111
+ | 'version'
112
+ | 'version-order'
113
+ | 'source'
114
+ | 'git-commit'
115
+ | 'timestamp'
116
+ | 'icon';
117
+
118
+ export interface MarketIndexProblem {
119
+ readonly kind: MarketIndexProblemKind;
120
+ readonly detail: string;
121
+ readonly at?: string;
122
+ }
123
+
124
+ export type MarketIndexParse =
125
+ | { readonly ok: true; readonly index: MarketIndex }
126
+ | { readonly ok: false; readonly problems: readonly MarketIndexProblem[] };
127
+
128
+ export type DiscoverCompat = 'ok' | 'incompatible' | 'unknown';
129
+
130
+ export type DiscoverInstallState = 'not-installed' | 'installed' | 'update-available' | 'different-version';
131
+
132
+ export interface DiscoverVersionRow {
133
+ readonly version: string;
134
+ readonly publishTimestamp?: number;
135
+ readonly source: MarketIndexSource;
136
+ readonly engines?: MarketIndexEngines;
137
+ readonly compat: DiscoverCompat;
138
+ readonly peer?: string;
139
+ readonly install: DiscoverInstallState;
140
+ }
141
+
142
+ export interface DiscoverEntry {
143
+ readonly name: string;
144
+ readonly title?: MarketLocalizedText;
145
+ readonly description?: MarketLocalizedText;
146
+ readonly author?: string;
147
+ readonly homepage?: string;
148
+ readonly icon?: string;
149
+ readonly category?: string;
150
+ readonly labels: readonly string[];
151
+ readonly installedVersion?: string;
152
+ readonly versions: readonly DiscoverVersionRow[];
153
+ }
154
+
155
+ export interface DiscoverSourceRow extends MarketSourceConfig {
156
+ readonly writable: boolean | null;
157
+ }
158
+
159
+ export type DiscoverState = 'no-source' | 'ready' | 'unreadable' | 'invalid';
160
+
161
+ export interface DiscoverProblem {
162
+ readonly kind:
163
+ | 'no-source'
164
+ | 'http-status'
165
+ | 'http-network'
166
+ | 'http-url'
167
+ | 'git-missing'
168
+ | 'git-network'
169
+ | 'git-auth'
170
+ | 'git-file'
171
+ | 'git-empty'
172
+ | 'git-missing-index'
173
+ | 'format'
174
+ | 'timeout'
175
+ | 'unknown';
176
+ readonly detail?: string;
177
+ readonly branch?: string;
178
+ }
179
+
180
+ export interface DiscoverPayload {
181
+ readonly state: DiscoverState;
182
+ readonly sources: readonly DiscoverSourceRow[];
183
+ readonly selected: string | null;
184
+ readonly entries: readonly DiscoverEntry[];
185
+ readonly fetchedAt?: number;
186
+ readonly commit?: string;
187
+ readonly stale?: boolean;
188
+ readonly problem?: DiscoverProblem;
189
+ }
190
+
191
+ export interface DiscoverFilter {
192
+ readonly query?: string;
193
+ readonly category?: string;
194
+ readonly label?: string;
195
+ }
196
+
197
+ export interface MarketSourcesPayload {
198
+ readonly sources: readonly MarketSourceConfig[];
199
+ readonly selected: string | null;
200
+ }
201
+
202
+ export interface MarketPublishDestination {
203
+ readonly url: string;
204
+ readonly ref?: string;
205
+ readonly indexPath: string;
206
+ readonly artifactPath: string;
207
+ readonly files: readonly string[];
208
+ readonly nextVersion?: string;
209
+ }
210
+
211
+ export interface PublishChangelog {
212
+ readonly version: string;
213
+ readonly text?: string;
214
+ readonly missing?: boolean;
215
+ }
216
+
217
+ export interface PublishPreview {
218
+ readonly name: string;
219
+ readonly version: string;
220
+ readonly registry?: string;
221
+ readonly market?: MarketPublishDestination;
222
+ readonly changelog?: PublishChangelog;
223
+ }
224
+
225
+ export type DiscoverDocKind = 'readme' | 'changelog';
226
+
227
+ export type DiscoverDoc =
228
+ | {
229
+ readonly ok: true;
230
+ readonly kind: DiscoverDocKind;
231
+ readonly version: string;
232
+ readonly text: string;
233
+ }
234
+ | {
235
+ readonly ok: false;
236
+ readonly kind: DiscoverDocKind;
237
+ readonly version: string;
238
+ readonly reason: 'missing' | 'unavailable';
239
+ readonly detail?: string;
240
+ };
241
+
242
+ export type MarketSourcesAction =
243
+ | { readonly action: 'save'; readonly source: MarketSourceConfig; readonly select?: boolean }
244
+ | { readonly action: 'remove'; readonly id: string }
245
+ | { readonly action: 'select'; readonly id: string | null }
246
+ | { readonly action: 'init'; readonly id: string; readonly ref?: string };
@@ -0,0 +1,47 @@
1
+ export type Deployment = 'web' | 'desktop';
2
+
3
+ export type HostOs = 'darwin' | 'win32' | 'linux' | 'other';
4
+
5
+ export type HostRuntime = 'electron' | 'node';
6
+
7
+ export type ClientShell = 'electron' | 'browser';
8
+
9
+ export type ProfileName = 'desktop' | 'web' | 'workbench' | 'headless' | 'other';
10
+
11
+ export type SelfUpdateCli = 'path-dsh' | 'desktop-cli';
12
+
13
+ export interface HostCapabilities {
14
+ readonly pageDebug: boolean;
15
+ readonly siteExplore: boolean;
16
+ readonly recording: boolean;
17
+ readonly browserWake: boolean;
18
+ readonly selfUpdateCli: SelfUpdateCli;
19
+ readonly safeMode: boolean;
20
+ }
21
+
22
+ export interface ToolchainPlan {
23
+ readonly node: { readonly source: 'desktop-shim' | 'path' };
24
+ readonly npm: { readonly neededFor: 'opencli-install' };
25
+ readonly pnpm: { readonly neededFor: 'workshop'; readonly expectedMajor: 10 };
26
+ }
27
+
28
+ export interface HostSurface {
29
+ readonly deployment: Deployment;
30
+ readonly hostOs: HostOs;
31
+ readonly runtime: HostRuntime;
32
+ readonly profile: ProfileName;
33
+ readonly capabilities: HostCapabilities;
34
+ readonly restartHint: string;
35
+ readonly toolchain: ToolchainPlan;
36
+ }
37
+
38
+ export interface ClientCapabilities {
39
+ readonly debugFooter: boolean;
40
+ }
41
+
42
+ export interface ClientSurface {
43
+ readonly deployment: Deployment;
44
+ readonly shell: ClientShell;
45
+ readonly hostOs: HostOs;
46
+ readonly capabilities: ClientCapabilities;
47
+ }
@@ -0,0 +1,17 @@
1
+ export const WAKE_BROWSER_ROUTE = 'wake-browser';
2
+
3
+ export type DesktopBrowserId = 'chrome' | 'edge' | 'brave' | 'chromium' | 'vivaldi';
4
+
5
+ export type BrowserWakeStatus =
6
+ | 'connected'
7
+ | 'browser-open'
8
+ | 'no-browser'
9
+ | 'launch-failed'
10
+ | 'not-connected'
11
+ | 'unsupported'
12
+ | 'unknown';
13
+
14
+ export interface WakeBrowserReply {
15
+ readonly status: BrowserWakeStatus;
16
+ readonly browser?: DesktopBrowserId;
17
+ }
@@ -0,0 +1,36 @@
1
+ export const PROFILE_CREATE_ROUTE = 'profile-create';
2
+
3
+ export const PROFILE_CREATE_RESOURCE = 'profileCreate';
4
+
5
+ export interface ProfileCreateProfile {
6
+ readonly name: string;
7
+ readonly current: boolean;
8
+ readonly readable: boolean;
9
+ }
10
+
11
+ export interface ProfileCreateSnapshot {
12
+ readonly current: string;
13
+ readonly profiles: readonly ProfileCreateProfile[];
14
+ }
15
+
16
+ export interface ProfileCreateCopy {
17
+ readonly settings: boolean;
18
+ readonly plugins: boolean;
19
+ readonly projects: boolean;
20
+ readonly sessions: boolean;
21
+ }
22
+
23
+ export interface ProfileCreateRequest {
24
+ readonly profile: string;
25
+ readonly source: string;
26
+ readonly copy: ProfileCreateCopy;
27
+ }
28
+
29
+ export interface ProfileCreateApplied {
30
+ readonly ok: true;
31
+ readonly profile: string;
32
+ readonly source: string;
33
+ readonly home: string;
34
+ readonly command: string;
35
+ readonly copied: readonly string[];
36
+ }
@@ -0,0 +1,19 @@
1
+ export const SIDEBAR_EDITION_ROUTE = 'sidebar-edition';
2
+
3
+ export const SIDEBAR_EDITION_RESOURCE = 'sidebarEdition';
4
+
5
+ export type SidebarEdition = 'official' | 'custom';
6
+
7
+ export interface SidebarEditionSnapshot {
8
+ readonly edition: SidebarEdition;
9
+ }
10
+
11
+ export interface SidebarEditionApplied {
12
+ readonly ok: true;
13
+ readonly edition: SidebarEdition;
14
+ readonly reloadRequired: boolean;
15
+ }
16
+
17
+ export interface SidebarEditionRequest {
18
+ readonly edition: SidebarEdition;
19
+ }
@@ -0,0 +1,8 @@
1
+ import type { UnitManifest } from '../unit.js';
2
+
3
+ export const UNIT_MANIFESTS_ROUTE = 'unit-manifests';
4
+
5
+ export interface UnitManifestsPayload {
6
+ readonly manifests: readonly UnitManifest[];
7
+ readonly installable: readonly string[];
8
+ }
@@ -21,4 +21,3 @@ export interface UnitBlockers {
21
21
  readonly blocker?: ModuleBlocker;
22
22
  readonly notice?: ModuleBlocker;
23
23
  }
24
-
@@ -0,0 +1,37 @@
1
+ import type { Need, NeedKind } from './needs.js';
2
+ import type { ProvisionProblem } from './plugin-source.js';
3
+
4
+ /**
5
+ * 一条 need 探出来的样子:状态、给人看的一句、以及能照做的修法。
6
+ */
7
+ export interface NeedState {
8
+ readonly id: string;
9
+ readonly kind: NeedKind;
10
+ readonly name: string;
11
+ readonly status: 'ok' | 'missing' | 'outdated' | 'unsatisfied' | 'unchecked';
12
+ readonly detail: string;
13
+ readonly command?: string;
14
+ readonly missing?: readonly string[];
15
+ readonly installed?: string;
16
+ readonly latest?: string;
17
+ readonly provision?: 'ready' | ProvisionProblem;
18
+ }
19
+
20
+ /**
21
+ * 一个单元的能力结论:unit 一级只做汇总,缺什么逐条看 needs。
22
+ */
23
+ export interface UnitCapability {
24
+ readonly unit: string;
25
+ readonly status: 'ok' | 'degraded' | 'missing' | 'outdated' | 'unchecked' | 'unsupported' | 'failed';
26
+ readonly needs: readonly NeedState[];
27
+ readonly detail?: string;
28
+ readonly released?: boolean;
29
+ }
30
+
31
+ /**
32
+ * 探一个单元的输入:单元 id 加它声明的 need 列表。
33
+ */
34
+ export interface NeedProbeInput {
35
+ readonly unit: string;
36
+ readonly needs: readonly Need[];
37
+ }
@@ -1,9 +1,10 @@
1
- import type { UnitEnvNeeds, UnitHostNeeds, UnitManifest } from '../api/unit.js';
1
+ import type { UnitHostNeeds, UnitManifest } from '../contract/unit.js';
2
+ import { needsProblemsOf, type Need } from './needs.js';
2
3
 
3
4
  /**
4
5
  * 声明协议当前版本;模块清单的 dsh.workbench.apiVersion 要写这个整数。
5
6
  */
6
- export const WORKBENCH_API_VERSION = 1;
7
+ export const WORKBENCH_API_VERSION = 2;
7
8
 
8
9
  /**
9
10
  * 外壳愿意认的协议版本;不在表里的模块当场被拒,不猜语义。
@@ -36,11 +37,11 @@ export interface UnitDeclaration {
36
37
  readonly card: UnitCardDeclaration | null;
37
38
  readonly tools: readonly UnitToolDeclaration[];
38
39
  readonly host: UnitHostNeeds;
39
- readonly env?: UnitEnvNeeds;
40
+ readonly needs?: readonly Need[];
40
41
  }
41
42
 
42
43
  /**
43
- * 协议认得的全部键;写了别的键不会被采纳(外壳静默忽略),所以字段名拼错不会有提示。
44
+ * 协议认得的全部键;写了别的键这份清单会被拒(`protocol` 判据与运行时同一套),拼错当场报出来。
44
45
  */
45
46
  export const DECLARATION_KEYS: readonly string[] = [
46
47
  'apiVersion',
@@ -48,11 +49,11 @@ export const DECLARATION_KEYS: readonly string[] = [
48
49
  'card',
49
50
  'tools',
50
51
  'host',
51
- 'env',
52
+ 'needs',
52
53
  ];
53
54
 
54
55
  /**
55
- * 协议要求必写的键;env 不在其中(没有环境需要就不写)。
56
+ * 协议要求必写的键;needs 不在其中(没有环境需要就不写)。
56
57
  */
57
58
  export const DECLARATION_REQUIRED_KEYS: readonly string[] = [
58
59
  'apiVersion',
@@ -104,13 +105,19 @@ export function declarationProblemsOf(subject: string, raw: unknown): readonly s
104
105
  if (version === undefined) {
105
106
  return [
106
107
  `${subject}: dsh.workbench 没有 apiVersion —— 协议从 v${WORKBENCH_API_VERSION} 起,` +
107
- `写 \`"apiVersion": ${WORKBENCH_API_VERSION}\`。缺它 = 外壳不认这个模块(ADR-0038 §2.3)`,
108
+ `写 \`"apiVersion": ${WORKBENCH_API_VERSION}\`。缺它 = 外壳不认这个模块`,
108
109
  ];
109
110
  }
110
111
  if (!Number.isInteger(version) || !SUPPORTED_API_VERSIONS.includes(version as number)) {
112
+ const hint =
113
+ version === 1
114
+ ? ` —— v2 把 \`env\` 的三张表(command / plugins / libs)换成了 \`needs\`:` +
115
+ '把外部需要逐条写成 `{ kind, name, purpose, ... }`(kind 是 bin / extension / lib / env),' +
116
+ '再把 apiVersion 改成 2'
117
+ : '';
111
118
  return [
112
119
  `${subject}: dsh.workbench.apiVersion 是 ${JSON.stringify(version)},这里只认 ` +
113
- `${SUPPORTED_API_VERSIONS.join(' / ')}(要整数)`,
120
+ `${SUPPORTED_API_VERSIONS.join(' / ')}(要整数)${hint}`,
114
121
  ];
115
122
  }
116
123
 
@@ -120,7 +127,7 @@ export function declarationProblemsOf(subject: string, raw: unknown): readonly s
120
127
  if (unknown.length > 0) {
121
128
  problems.push(
122
129
  `${subject}: dsh.workbench 里有协议 v${WORKBENCH_API_VERSION} 不认识的键 ${listOf(unknown)} —— ` +
123
- `只有 ${listOf(DECLARATION_KEYS)}。(拼错的键会被外壳**静默忽略**:那句声明等于没写)`,
130
+ `只有 ${listOf(DECLARATION_KEYS)}。(协议外的键会让这份清单被拒:那句声明等于没写)`,
124
131
  );
125
132
  }
126
133
 
@@ -224,13 +231,6 @@ export function declarationProblemsOf(subject: string, raw: unknown): readonly s
224
231
  }
225
232
  }
226
233
 
227
- if (raw.env !== undefined && !isRecord(raw.env)) {
228
- problems.push(
229
- `${subject}: dsh.workbench.env 要是对象(command / plugins / libs)—— ` +
230
- `语义由门禁的 env 判据查,这里只查形状`,
231
- );
232
- }
233
-
234
234
  return problems;
235
235
  }
236
236
 
@@ -241,6 +241,7 @@ export interface DeclarationRead {
241
241
  readonly declaration?: UnitDeclaration;
242
242
  readonly manifest?: UnitManifest;
243
243
  readonly problems: readonly string[];
244
+ readonly warnings: readonly string[];
244
245
  }
245
246
 
246
247
  /**
@@ -251,8 +252,10 @@ export interface DeclarationRead {
251
252
  */
252
253
  export function readDeclaration(subject: string, raw: unknown): DeclarationRead {
253
254
  const problems = declarationProblemsOf(subject, raw);
254
- if (problems.length > 0) return { problems };
255
+ if (problems.length > 0) return { problems, warnings: [] };
255
256
  const declaration = raw as UnitDeclaration;
257
+ const needsRead = needsProblemsOf(subject, declaration.needs);
258
+ if (needsRead.errors.length > 0) return { problems: needsRead.errors, warnings: needsRead.warnings };
256
259
  const card = declaration.card;
257
260
  return {
258
261
  declaration,
@@ -274,7 +277,8 @@ export function readDeclaration(subject: string, raw: unknown): DeclarationRead
274
277
  inject: [...(declaration.host.inject ?? [])],
275
278
  ...(declaration.host.optional === undefined ? {} : { optional: [...declaration.host.optional] }),
276
279
  },
277
- ...(declaration.env === undefined ? {} : { env: declaration.env }),
280
+ ...(declaration.needs === undefined ? {} : { needs: declaration.needs }),
278
281
  },
282
+ warnings: needsRead.warnings,
279
283
  };
280
284
  }
@@ -0,0 +1,76 @@
1
+ import type { ExtensionNeed, LibNeed, Need } from './needs.js';
2
+
3
+ /**
4
+ * 一张卡片在清单里的静态声明(文案键加排序位);默认显不显示由运行期面板配置定。
5
+ */
6
+ export interface UnitCard {
7
+ readonly titleKey: string;
8
+ readonly order: number;
9
+ }
10
+
11
+ /**
12
+ * 一条工具在清单里的样子:全名加会不会写;审批按 writes 认领。
13
+ */
14
+ export interface UnitTool {
15
+ readonly name: string;
16
+ readonly writes: boolean;
17
+ }
18
+
19
+ /**
20
+ * 模块要外壳的哪些服务:inject 缺一个就挂不上,optional 缺了照挂。
21
+ */
22
+ export interface UnitHostNeeds {
23
+ readonly inject: readonly string[];
24
+ readonly optional?: readonly string[];
25
+ }
26
+
27
+ /**
28
+ * 已装插件与源上最新版那一对,用来判该不该提示升级;latest 缺省表示还没查到。
29
+ */
30
+ export interface PluginRelease {
31
+ readonly installed: string;
32
+ readonly latest?: string;
33
+ }
34
+
35
+ /**
36
+ * 装配期用的模块清单:单元 id、卡片、工具、宿主服务与环境需要,比声明少一层协议包装。
37
+ */
38
+ export interface UnitManifest {
39
+ readonly id: string;
40
+ readonly card: UnitCard | null;
41
+ readonly tools: readonly UnitTool[];
42
+ readonly host: UnitHostNeeds;
43
+ readonly needs?: readonly Need[];
44
+ }
45
+
46
+ /**
47
+ * 模块声明的全部环境需要(没写就是空表)。
48
+ * @param manifest 模块清单。
49
+ * @returns need 列表。
50
+ */
51
+ export function needsOf(manifest: UnitManifest): readonly Need[] {
52
+ return manifest.needs ?? [];
53
+ }
54
+
55
+ /**
56
+ * 宿主能代装的那些需要:只有写了 `sources` 的 extension / lib 算。
57
+ * @param manifest 模块清单。
58
+ * @returns 可代装的 need 列表。
59
+ */
60
+ export function provisionableNeedsOf(manifest: UnitManifest): readonly (ExtensionNeed | LibNeed)[] {
61
+ return needsOf(manifest).filter(
62
+ (need): need is ExtensionNeed | LibNeed =>
63
+ (need.kind === 'extension' || need.kind === 'lib') && (need.sources ?? []).length > 0,
64
+ );
65
+ }
66
+
67
+ /**
68
+ * 市场门槛要看的那些需要:声明了 extension / lib 就算(不要求写了来源)。
69
+ * @param manifest 模块清单。
70
+ * @returns extension / lib 的 need 列表。
71
+ */
72
+ export function supplyNeedsOf(manifest: UnitManifest): readonly (ExtensionNeed | LibNeed)[] {
73
+ return needsOf(manifest).filter(
74
+ (need): need is ExtensionNeed | LibNeed => need.kind === 'extension' || need.kind === 'lib',
75
+ );
76
+ }
@@ -0,0 +1,30 @@
1
+ import type { NeedState } from '../contract/unit-capability.js';
2
+
3
+ /**
4
+ * 供给动作的那几档(装 / 升 / 卸,模块、共用依赖与插件各一套);写口按它分派。
5
+ */
6
+ export type ProvisionAction =
7
+ | 'install'
8
+ | 'update'
9
+ | 'uninstall'
10
+ | 'update-dependency'
11
+ | 'install-bundle'
12
+ | 'install-version'
13
+ | 'update-bundle'
14
+ | 'remove-bundle'
15
+ | 'cancel-install'
16
+ | 'update-plugin'
17
+ | 'uninstall-plugin'
18
+ | 'update-workbench';
19
+
20
+ /**
21
+ * 宿主对「这个单元现在能不能用」的那份读数:状态汇总加逐条 need 的细节。
22
+ */
23
+ export interface CapabilityPayload {
24
+ readonly unit: string;
25
+ readonly status: 'ok' | 'degraded' | 'missing' | 'outdated' | 'unchecked' | 'unsupported' | 'failed';
26
+ readonly needs: readonly NeedState[];
27
+ readonly detail?: string;
28
+ readonly released?: boolean;
29
+ }
30
+