@dsh-workbench/shared 0.3.10 → 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 (391) 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 +19 -1
  6. package/dist/api/host-write.d.ts +0 -15
  7. package/dist/api/host-write.js +1 -35
  8. package/dist/api/workbench-client.js +2 -1
  9. package/dist/components/Activity.css +0 -1
  10. package/dist/components/ApprovalDetail.css +1 -2
  11. package/dist/components/ApprovalDetail.d.ts +1 -1
  12. package/dist/components/ApprovalPlan.css +0 -1
  13. package/dist/components/Card.css +0 -1
  14. package/dist/components/Card.d.ts +1 -1
  15. package/dist/components/CardBoundary.d.ts +1 -1
  16. package/dist/components/CardHead.css +0 -1
  17. package/dist/components/CardHead.d.ts +1 -1
  18. package/dist/components/ChoiceGroup.css +1 -2
  19. package/dist/components/ConfirmBar.d.ts +1 -1
  20. package/dist/components/ConfirmBar.js +1 -1
  21. package/dist/components/Form.css +1 -1
  22. package/dist/components/FormActions.js +1 -1
  23. package/dist/components/LongTaskRow.css +1 -2
  24. package/dist/components/LongTaskRow.d.ts +1 -1
  25. package/dist/components/LongTaskRow.js +1 -1
  26. package/dist/components/Note.css +0 -1
  27. package/dist/components/ResourceStates.css +0 -1
  28. package/dist/components/SettingsSection.css +0 -1
  29. package/dist/components/Spinner.css +0 -1
  30. package/dist/components/Stack.css +0 -1
  31. package/dist/components/StateBlock.css +0 -1
  32. package/dist/components/board-module.d.ts +3 -3
  33. package/dist/components/icons.d.ts +1 -7
  34. package/dist/components/icons.js +11 -16
  35. package/dist/config/constants.d.ts +2 -2
  36. package/dist/config/constants.js +2 -2
  37. package/dist/config/storage.d.ts +0 -4
  38. package/dist/config/storage.js +0 -11
  39. package/dist/contract/adapters.d.ts +10 -0
  40. package/dist/contract/cli.d.ts +3 -0
  41. package/dist/contract/data.d.ts +126 -0
  42. package/dist/{api → contract}/facts.d.ts +12 -3
  43. package/dist/{api → contract}/facts.js +19 -1
  44. package/dist/contract/needs.d.ts +132 -0
  45. package/dist/contract/needs.js +232 -0
  46. package/dist/contract/plugin-source.d.ts +1 -0
  47. package/dist/contract/plugin-source.js +1 -0
  48. package/dist/contract/protocol/bundle-install.d.ts +136 -0
  49. package/dist/contract/protocol/bundle-install.js +12 -0
  50. package/dist/contract/protocol/config-sync.d.ts +55 -0
  51. package/dist/contract/protocol/config-sync.js +2 -0
  52. package/dist/contract/protocol/diy.d.ts +4 -0
  53. package/dist/contract/protocol/diy.js +4 -0
  54. package/dist/contract/protocol/dsh-plugins.d.ts +11 -0
  55. package/dist/contract/protocol/dsh-plugins.js +1 -0
  56. package/dist/contract/protocol/long-tasks.d.ts +13 -0
  57. package/dist/contract/protocol/long-tasks.js +1 -0
  58. package/dist/contract/protocol/market-index.d.ts +195 -0
  59. package/dist/contract/protocol/market-index.js +7 -0
  60. package/dist/contract/protocol/platform.d.ts +44 -0
  61. package/dist/contract/protocol/platform.js +1 -0
  62. package/dist/contract/protocol/preflight-wake.d.ts +7 -0
  63. package/dist/contract/protocol/preflight-wake.js +1 -0
  64. package/dist/contract/protocol/profile-create.d.ts +30 -0
  65. package/dist/contract/protocol/profile-create.js +2 -0
  66. package/dist/contract/protocol/sidebar-edition.d.ts +14 -0
  67. package/dist/contract/protocol/sidebar-edition.js +2 -0
  68. package/dist/contract/protocol/unit-manifests.d.ts +6 -0
  69. package/dist/contract/protocol/unit-manifests.js +1 -0
  70. package/dist/contract/unit-board.d.ts +18 -0
  71. package/dist/contract/unit-board.js +1 -0
  72. package/dist/contract/unit-capability.d.ts +34 -0
  73. package/dist/contract/unit-capability.js +1 -0
  74. package/dist/{api → contract}/unit-declaration.d.ts +7 -5
  75. package/dist/{api → contract}/unit-declaration.js +19 -13
  76. package/dist/contract/unit.d.ts +57 -0
  77. package/dist/contract/unit.js +24 -0
  78. package/dist/contract/workbench-contract.d.ts +15 -0
  79. package/dist/contract/workbench-contract.js +1 -0
  80. package/dist/host/adapter-set.d.ts +26 -0
  81. package/dist/host/adapter-set.js +243 -0
  82. package/dist/host/adapter-types.d.ts +79 -0
  83. package/dist/host/adapter-types.js +23 -0
  84. package/dist/host/adapters.d.ts +22 -0
  85. package/dist/host/adapters.js +9 -0
  86. package/dist/host/browser.d.ts +3 -0
  87. package/dist/host/browser.js +3 -0
  88. package/dist/host/changelog.d.ts +21 -0
  89. package/dist/host/changelog.js +188 -0
  90. package/dist/host/channel-plugin.d.ts +15 -0
  91. package/dist/host/channel-plugin.js +42 -0
  92. package/dist/host/cli.d.ts +4 -0
  93. package/dist/host/cli.js +7 -0
  94. package/dist/host/command-name.d.ts +1 -0
  95. package/dist/host/command-name.js +14 -0
  96. package/dist/host/data-error.d.ts +13 -0
  97. package/dist/host/data-error.js +20 -0
  98. package/dist/host/data-root.js +3 -0
  99. package/dist/host/diy-debug.js +2 -1
  100. package/dist/host/diy-record.js +2 -1
  101. package/dist/host/facts.d.ts +1 -1
  102. package/dist/host/facts.js +3 -2
  103. package/dist/host/git.js +2 -2
  104. package/dist/host/http.js +1 -1
  105. package/dist/host/lib-capabilities.d.ts +22 -0
  106. package/dist/host/lib-capabilities.js +37 -0
  107. package/dist/host/lib-install.d.ts +9 -0
  108. package/dist/host/lib-install.js +10 -0
  109. package/dist/host/long-task.d.ts +1 -1
  110. package/dist/host/long-task.js +4 -3
  111. package/dist/host/market-index.d.ts +22 -0
  112. package/dist/host/market-index.js +420 -0
  113. package/dist/host/needs.d.ts +4 -0
  114. package/dist/host/needs.js +2 -0
  115. package/dist/host/patch.d.ts +9 -0
  116. package/dist/host/patch.js +78 -0
  117. package/dist/host/paths.d.ts +12 -0
  118. package/dist/host/paths.js +28 -0
  119. package/dist/host/platform.d.ts +14 -0
  120. package/dist/host/platform.js +40 -0
  121. package/dist/host/plugin-source.d.ts +8 -6
  122. package/dist/host/plugin-source.js +43 -33
  123. package/dist/host/plugin.d.ts +4 -0
  124. package/dist/host/plugin.js +39 -0
  125. package/dist/host/port-types.d.ts +191 -0
  126. package/dist/host/port-types.js +1 -0
  127. package/dist/host/preflight.d.ts +28 -0
  128. package/dist/host/preflight.js +1 -0
  129. package/dist/host/profile-port.d.ts +4 -0
  130. package/dist/host/profile-port.js +4 -0
  131. package/dist/host/provision.d.ts +2 -2
  132. package/dist/host/provision.js +5 -3
  133. package/dist/host/recipe-rules.d.ts +5 -0
  134. package/dist/host/recipe-rules.js +382 -0
  135. package/dist/host/recipe.d.ts +14 -0
  136. package/dist/host/recipe.js +283 -0
  137. package/dist/host/shell-text.d.ts +9 -2
  138. package/dist/host/shell-text.js +15 -3
  139. package/dist/host/shell.d.ts +2 -0
  140. package/dist/host/shell.js +7 -0
  141. package/dist/host/spec.d.ts +8 -0
  142. package/dist/host/spec.js +24 -0
  143. package/dist/host/supply-index.d.ts +34 -0
  144. package/dist/host/supply-index.js +202 -0
  145. package/dist/host/supply-port.d.ts +5 -0
  146. package/dist/host/supply-port.js +39 -0
  147. package/dist/host/time.d.ts +12 -0
  148. package/dist/host/time.js +19 -0
  149. package/dist/host/tokens.d.ts +26 -0
  150. package/dist/host/tokens.js +154 -0
  151. package/dist/host/tool-approval.d.ts +12 -0
  152. package/dist/host/tool-approval.js +4 -0
  153. package/dist/host/tool-kit.js +1 -1
  154. package/dist/host/unit-face.d.ts +5 -4
  155. package/dist/host/version-range.d.ts +2 -0
  156. package/dist/host/version-range.js +73 -0
  157. package/dist/host/version.d.ts +3 -0
  158. package/dist/host/version.js +29 -0
  159. package/dist/host.d.ts +47 -16
  160. package/dist/host.js +47 -16
  161. package/dist/i18n/en.js +259 -86
  162. package/dist/i18n/index.d.ts +333 -88
  163. package/dist/i18n/merge.js +1 -1
  164. package/dist/i18n/need-text.d.ts +26 -0
  165. package/dist/i18n/need-text.js +26 -0
  166. package/dist/i18n/settings.d.ts +70 -0
  167. package/dist/i18n/settings.js +136 -0
  168. package/dist/i18n/zh.d.ts +332 -87
  169. package/dist/i18n/zh.js +260 -87
  170. package/dist/index.d.ts +24 -8
  171. package/dist/index.js +24 -8
  172. package/dist/lib/blocker-action.d.ts +0 -15
  173. package/dist/lib/blocker-action.js +1 -25
  174. package/dist/{api → lib}/dsh-client.d.ts +12 -1
  175. package/dist/lib/dsh-client.js +1 -0
  176. package/dist/lib/market-index.d.ts +7 -0
  177. package/dist/lib/market-index.js +25 -0
  178. package/dist/lib/react-types.d.ts +5 -0
  179. package/dist/lib/react-types.js +1 -0
  180. package/dist/lib/react.d.ts +1 -40
  181. package/dist/lib/react.js +0 -36
  182. package/dist/lib/ui.js +3 -9
  183. package/dist/testing/data.d.ts +13 -0
  184. package/dist/testing/data.js +46 -0
  185. package/dist/testing/declaration.d.ts +1 -1
  186. package/dist/testing/declaration.js +1 -1
  187. package/dist/testing/host-fakes.d.ts +0 -13
  188. package/dist/testing/host-fakes.js +0 -24
  189. package/dist/testing/needs.d.ts +16 -0
  190. package/dist/testing/needs.js +46 -0
  191. package/dist/testing.d.ts +2 -0
  192. package/dist/testing.js +2 -0
  193. package/package.json +18 -2
  194. package/src/api/__tests__/blocker-table.test.ts +135 -86
  195. package/src/api/blocker-table.ts +52 -26
  196. package/src/api/dsh.ts +17 -1
  197. package/src/api/host-write.ts +0 -43
  198. package/src/api/workbench-client.test.ts +2 -2
  199. package/src/api/workbench-client.ts +2 -1
  200. package/src/components/Activity.css +0 -1
  201. package/src/components/ApprovalDetail.css +1 -2
  202. package/src/components/ApprovalDetail.tsx +1 -1
  203. package/src/components/ApprovalPlan.css +0 -1
  204. package/src/components/Card.css +0 -1
  205. package/src/components/Card.tsx +1 -1
  206. package/src/components/CardAnchor.test.tsx +1 -1
  207. package/src/components/CardBoundary.tsx +1 -1
  208. package/src/components/CardHead.css +0 -1
  209. package/src/components/CardHead.tsx +1 -1
  210. package/src/components/ChoiceGroup.css +1 -2
  211. package/src/components/ConfirmBar.tsx +1 -1
  212. package/src/components/Form.css +1 -1
  213. package/src/components/Form.tsx +1 -1
  214. package/src/components/FormActions.tsx +1 -1
  215. package/src/components/LongTaskRow.css +1 -2
  216. package/src/components/LongTaskRow.tsx +1 -1
  217. package/src/components/Note.css +0 -1
  218. package/src/components/ResourceStates.css +0 -1
  219. package/src/components/SelectFieldNodes.tsx +0 -1
  220. package/src/components/SettingsSection.css +0 -1
  221. package/src/components/Spinner.css +0 -1
  222. package/src/components/Stack.css +0 -1
  223. package/src/components/StateBlock.css +0 -1
  224. package/src/components/__tests__/long-task-row.test.ts +1 -1
  225. package/src/components/board-module.ts +3 -3
  226. package/src/components/icons.tsx +16 -24
  227. package/src/config/constants.ts +2 -2
  228. package/src/config/storage.test.ts +1 -25
  229. package/src/config/storage.ts +0 -12
  230. package/src/{api → contract}/__tests__/facts.test.ts +73 -25
  231. package/src/{api → contract}/__tests__/long-task.test.ts +3 -3
  232. package/src/contract/__tests__/needs.test.ts +74 -0
  233. package/src/{host → contract}/__tests__/unit-declaration.test.ts +1 -1
  234. package/src/contract/__tests__/unit.test.ts +43 -0
  235. package/src/contract/adapters.ts +9 -0
  236. package/src/contract/cli.ts +3 -0
  237. package/src/contract/data.ts +145 -0
  238. package/src/{api → contract}/facts.ts +34 -4
  239. package/src/contract/needs.ts +331 -0
  240. package/src/contract/plugin-source.ts +1 -0
  241. package/src/contract/protocol/bundle-install.ts +198 -0
  242. package/src/contract/protocol/config-sync.ts +65 -0
  243. package/src/contract/protocol/diy.ts +4 -0
  244. package/src/contract/protocol/dsh-plugins.ts +13 -0
  245. package/src/contract/protocol/long-tasks.ts +16 -0
  246. package/src/contract/protocol/market-index.ts +246 -0
  247. package/src/contract/protocol/platform.ts +47 -0
  248. package/src/contract/protocol/preflight-wake.ts +17 -0
  249. package/src/contract/protocol/profile-create.ts +36 -0
  250. package/src/contract/protocol/sidebar-edition.ts +19 -0
  251. package/src/contract/protocol/unit-manifests.ts +8 -0
  252. package/src/contract/unit-board.ts +23 -0
  253. package/src/contract/unit-capability.ts +37 -0
  254. package/src/{host → contract}/unit-declaration.ts +22 -18
  255. package/src/contract/unit.ts +76 -0
  256. package/src/contract/workbench-contract.ts +30 -0
  257. package/src/host/__tests__/adapter-set.test.ts +228 -0
  258. package/src/host/__tests__/adapters.test.ts +27 -0
  259. package/src/host/__tests__/changelog.test.ts +102 -0
  260. package/src/host/__tests__/command-name.test.ts +16 -0
  261. package/src/host/__tests__/diy-record.test.ts +3 -3
  262. package/src/host/__tests__/facts.test.ts +5 -5
  263. package/src/host/__tests__/long-task.test.ts +1 -1
  264. package/src/host/__tests__/market-index.test.ts +179 -0
  265. package/src/host/__tests__/plugin-ledger.test.ts +10 -10
  266. package/src/host/__tests__/provision.test.ts +7 -6
  267. package/src/host/__tests__/shell-text.test.ts +16 -1
  268. package/src/host/__tests__/supply-index.test.ts +137 -0
  269. package/src/host/__tests__/tokens.test.ts +110 -0
  270. package/src/host/__tests__/version-range.test.ts +21 -0
  271. package/src/host/adapter-set.ts +298 -0
  272. package/src/host/adapter-types.ts +105 -0
  273. package/src/host/adapters.ts +44 -0
  274. package/src/host/browser.ts +3 -0
  275. package/src/host/changelog.ts +212 -0
  276. package/src/host/channel-plugin.ts +55 -0
  277. package/src/host/cli.ts +11 -0
  278. package/src/host/command-name.ts +15 -0
  279. package/src/host/data-error.ts +21 -0
  280. package/src/host/data-root.ts +2 -0
  281. package/src/host/diy-debug.ts +2 -1
  282. package/src/host/diy-record.ts +2 -1
  283. package/src/host/facts.ts +4 -3
  284. package/src/host/git.ts +2 -2
  285. package/src/host/http.ts +1 -1
  286. package/src/host/lib-capabilities.ts +52 -0
  287. package/src/host/lib-install.ts +18 -0
  288. package/src/host/long-task.ts +4 -3
  289. package/src/host/market-index.ts +413 -0
  290. package/src/host/needs.ts +6 -0
  291. package/src/host/patch.ts +93 -0
  292. package/src/host/paths.ts +37 -0
  293. package/src/host/platform.ts +48 -0
  294. package/src/host/plugin-source.ts +48 -56
  295. package/src/host/plugin.ts +39 -0
  296. package/src/host/port-types.ts +222 -0
  297. package/src/host/preflight.ts +31 -0
  298. package/src/host/profile-port.ts +9 -0
  299. package/src/host/provision.ts +7 -4
  300. package/src/host/recipe-rules.ts +330 -0
  301. package/src/host/recipe.test.ts +334 -0
  302. package/src/host/recipe.ts +323 -0
  303. package/src/host/shell-text.ts +15 -3
  304. package/src/host/shell.ts +9 -0
  305. package/src/host/spec.ts +32 -0
  306. package/src/host/supply-index.ts +256 -0
  307. package/src/host/supply-port.ts +45 -0
  308. package/src/host/time.ts +22 -0
  309. package/src/host/tokens.ts +186 -0
  310. package/src/host/tool-approval.ts +17 -0
  311. package/src/host/tool-kit.ts +1 -1
  312. package/src/host/unit-face.ts +5 -4
  313. package/src/host/version-range.ts +71 -0
  314. package/src/host/version.ts +30 -0
  315. package/src/host.ts +47 -16
  316. package/src/i18n/en.ts +261 -86
  317. package/src/i18n/merge.test.ts +6 -6
  318. package/src/i18n/merge.ts +1 -1
  319. package/src/i18n/need-text.ts +27 -0
  320. package/src/i18n/settings.ts +141 -0
  321. package/src/i18n/zh.ts +263 -87
  322. package/src/index.ts +24 -8
  323. package/src/lib/blocker-action.ts +0 -28
  324. package/src/{api → lib}/dsh-client.ts +16 -2
  325. package/src/lib/market-index.ts +36 -0
  326. package/src/lib/react-types.ts +5 -0
  327. package/src/lib/react.ts +1 -40
  328. package/src/lib/text.test.ts +2 -2
  329. package/src/lib/ui.test.ts +6 -5
  330. package/src/lib/ui.ts +3 -9
  331. package/src/testing/__tests__/declaration.test.ts +1 -1
  332. package/src/testing/data.ts +66 -0
  333. package/src/testing/declaration.ts +2 -2
  334. package/src/testing/host-fakes.ts +0 -38
  335. package/src/testing/needs.ts +80 -0
  336. package/src/testing.ts +2 -0
  337. package/dist/api/unit-board.d.ts +0 -39
  338. package/dist/api/unit-board.js +0 -45
  339. package/dist/api/unit.d.ts +0 -85
  340. package/dist/api/unit.js +0 -8
  341. package/dist/api/workbench-contract.d.ts +0 -44
  342. package/dist/components/MockStrip.css +0 -39
  343. package/dist/components/MockStrip.d.ts +0 -15
  344. package/dist/components/MockStrip.js +0 -8
  345. package/dist/components/SaveBar.css +0 -7
  346. package/dist/host/browser-find.d.ts +0 -38
  347. package/dist/host/browser-find.js +0 -242
  348. package/dist/host/browser-read.d.ts +0 -28
  349. package/dist/host/browser-read.js +0 -243
  350. package/dist/host/opencli-runtime.d.ts +0 -25
  351. package/dist/host/opencli-runtime.js +0 -56
  352. package/dist/host/opencli-window.d.ts +0 -2
  353. package/dist/host/opencli-window.js +0 -8
  354. package/dist/host/opencli.d.ts +0 -37
  355. package/dist/host/opencli.js +0 -155
  356. package/dist/host/unit-declaration.d.ts +0 -65
  357. package/dist/host/unit-declaration.js +0 -213
  358. package/dist/host/unit-libs.d.ts +0 -37
  359. package/dist/lib/diy-debug.d.ts +0 -80
  360. package/dist/lib/diy-debug.js +0 -88
  361. package/dist/lib/diy-record.d.ts +0 -135
  362. package/dist/lib/diy-record.js +0 -162
  363. package/dist/lib/lint-probe.d.ts +0 -1
  364. package/dist/lib/lint-probe.js +0 -6
  365. package/dist/lib/panel-state.d.ts +0 -120
  366. package/dist/lib/panel-state.js +0 -176
  367. package/src/api/__tests__/host-write.test.ts +0 -75
  368. package/src/api/__tests__/unit-board.test.ts +0 -76
  369. package/src/api/__tests__/unit.test.ts +0 -38
  370. package/src/api/unit-board.ts +0 -69
  371. package/src/api/unit.ts +0 -93
  372. package/src/api/workbench-contract.ts +0 -59
  373. package/src/host/__tests__/browser-find.test.ts +0 -330
  374. package/src/host/__tests__/browser-read.test.ts +0 -228
  375. package/src/host/__tests__/opencli-runtime.test.ts +0 -46
  376. package/src/host/browser-find.ts +0 -311
  377. package/src/host/browser-read.ts +0 -311
  378. package/src/host/opencli-runtime.ts +0 -79
  379. package/src/host/opencli-window.ts +0 -11
  380. package/src/host/opencli.ts +0 -213
  381. package/src/host/unit-libs.ts +0 -41
  382. package/src/lib/blocker-action.test.ts +0 -40
  383. /package/dist/{api/blocker.js → contract/adapters.js} +0 -0
  384. /package/dist/{api → contract}/blocker.d.ts +0 -0
  385. /package/dist/{api/dsh-client.js → contract/blocker.js} +0 -0
  386. /package/dist/{api/workbench-contract.js → contract/cli.js} +0 -0
  387. /package/dist/{host/unit-libs.js → contract/data.js} +0 -0
  388. /package/dist/{api → contract}/long-task.d.ts +0 -0
  389. /package/dist/{api → contract}/long-task.js +0 -0
  390. /package/src/{api → contract}/blocker.ts +0 -0
  391. /package/src/{api → contract}/long-task.ts +0 -0
@@ -0,0 +1,198 @@
1
+ export const BUNDLE_REGISTRIES_ROUTE = 'bundle-registries';
2
+
3
+ export const BUNDLE_INSPECT_ROUTE = 'bundle-inspect';
4
+
5
+ export const BUNDLE_REGISTRY_DEFAULT = 'default';
6
+ export const MODULE_VERSIONS_ROUTE = 'module-versions';
7
+
8
+ export type BundleRegistry = string | null;
9
+
10
+ export interface BundleRegistries {
11
+ readonly registry: BundleRegistry;
12
+ readonly fallbackRegistries: readonly BundleRegistry[];
13
+ readonly resolved: string | null;
14
+ }
15
+
16
+ export type BundleInspectProblem =
17
+ | 'invalid-spec'
18
+ | 'already-installed'
19
+ | 'not-found'
20
+ | 'not-a-package'
21
+ | 'not-a-bundle'
22
+ | 'not-a-workbench-module'
23
+ | 'not-a-module-or-plugin'
24
+ | 'network'
25
+ | 'unknown';
26
+
27
+ export type BundleSpecKind = 'registry' | 'path' | 'git' | 'tarball';
28
+
29
+ export interface BundleInspectionAccepted {
30
+ readonly status: 'accepted';
31
+ readonly kind: BundleSpecKind;
32
+ readonly name?: string;
33
+ readonly version?: string;
34
+ readonly description?: string;
35
+ readonly bundle: boolean | null;
36
+ readonly registry: BundleRegistry;
37
+ readonly host?: string;
38
+ }
39
+
40
+ export interface BundleInspectionRefused {
41
+ readonly status: 'refused';
42
+ readonly problem: BundleInspectProblem;
43
+ readonly reason: string;
44
+ readonly registries?: readonly BundleRegistry[];
45
+ }
46
+
47
+ export interface BundleInspectionPlugin {
48
+ readonly status: 'plugin';
49
+ readonly pkg: string;
50
+ readonly registry: BundleRegistry;
51
+ readonly pluginName?: string;
52
+ readonly version?: string;
53
+ }
54
+
55
+ export type BundleInspection =
56
+ | BundleInspectionAccepted
57
+ | BundleInspectionRefused
58
+ | BundleInspectionPlugin;
59
+
60
+ export interface BundleRegistriesPayload {
61
+ readonly available: boolean;
62
+ readonly registries: BundleRegistries | null;
63
+ }
64
+
65
+ export interface BundleInspectionPayload {
66
+ readonly inspection: BundleInspection;
67
+ }
68
+
69
+ export type BundleApplication = 'applied' | 'restart-required' | 'overridden' | 'failed' | 'cancelled';
70
+
71
+ export const SELF_UPDATE_STATES = ['running', 'ok', 'rolled-back', 'failed'] as const;
72
+
73
+ export type SelfUpdateState = (typeof SELF_UPDATE_STATES)[number];
74
+
75
+ export interface WorkbenchSelfUpdate {
76
+ readonly state: SelfUpdateState;
77
+ readonly profile?: string;
78
+ readonly from?: string;
79
+ readonly to?: string;
80
+ readonly version?: string;
81
+ readonly at?: string;
82
+ readonly tail?: string;
83
+ }
84
+
85
+ export const RESTART_REASONS = [
86
+ 'no-hmr',
87
+ 'package-moved',
88
+ 'host-module',
89
+ 'unmanaged-plugin',
90
+ 'module-comparison',
91
+ ] as const;
92
+
93
+ export type RestartReason = (typeof RESTART_REASONS)[number];
94
+
95
+ export type BundleChangeStage = 'install' | 'enable' | 'remove';
96
+
97
+ export type BundleFailureKind =
98
+ | 'pnpm-missing'
99
+ | 'timeout'
100
+ | 'not-found'
101
+ | 'no-matching-version'
102
+ | 'network'
103
+ | 'disk-full'
104
+ | 'permission'
105
+ | 'build-blocked'
106
+ | 'integrity'
107
+ | 'unknown';
108
+
109
+ export interface BundlePackageResult {
110
+ readonly exitCode: number;
111
+ readonly output: string;
112
+ readonly truncated: boolean;
113
+ readonly logPath: string;
114
+ readonly kind?: BundleFailureKind;
115
+ }
116
+
117
+ export interface BundleChange {
118
+ readonly application: BundleApplication;
119
+ readonly stage: BundleChangeStage;
120
+ readonly changed: boolean;
121
+ readonly target: string;
122
+ readonly bundle?: string;
123
+ readonly version?: string;
124
+ readonly errorCode?: string;
125
+ readonly errorDetail?: string;
126
+ readonly packageResult?: BundlePackageResult;
127
+ readonly pendingBuilds?: readonly string[];
128
+ readonly restartReason?: RestartReason;
129
+ readonly failedAt?: 'registry' | 'spec-host';
130
+ }
131
+
132
+ export interface BundleInstallRequest {
133
+ readonly spec: string;
134
+ readonly registry?: BundleRegistry;
135
+ readonly requestId?: string;
136
+ readonly approvedBuilds?: readonly string[];
137
+ }
138
+
139
+ export type BundleCancellation = 'cancelled' | 'too-late' | 'not-running';
140
+
141
+ export type BundleSupplyState = 'not-a-module' | 'no-needs' | 'installed' | 'failed' | 'pending-restart';
142
+
143
+ export interface BundleModulePayload {
144
+ readonly kind: 'module' | 'not-module' | 'unknown';
145
+ readonly pkg: string;
146
+ readonly unit?: string;
147
+ readonly version?: string;
148
+ }
149
+
150
+ export interface BundleSupplyPayload {
151
+ readonly state: BundleSupplyState;
152
+ readonly reason?: string;
153
+ }
154
+
155
+ export interface BundleInstalledPlugin {
156
+ readonly kind: 'opencli-plugin';
157
+ readonly pkg: string;
158
+ readonly name?: string;
159
+ }
160
+
161
+ export interface BundleInstallPayload {
162
+ readonly change: BundleChange;
163
+ readonly module: BundleModulePayload;
164
+ readonly supply: BundleSupplyPayload;
165
+ readonly plugin?: BundleInstalledPlugin;
166
+ }
167
+
168
+ export interface BundleRemovePayload {
169
+ readonly change: BundleChange;
170
+ readonly keptFor: readonly string[];
171
+ }
172
+
173
+ export interface BundleCancellationPayload {
174
+ readonly cancellation: BundleCancellation | null;
175
+ }
176
+
177
+ export interface ModuleVersion {
178
+ readonly unit: string;
179
+ readonly pkg: string;
180
+ readonly installed: string;
181
+ readonly latest?: string;
182
+ readonly local?: boolean;
183
+ readonly refused?: readonly string[];
184
+ }
185
+
186
+ export interface WorkbenchVersion {
187
+ readonly pkg: string;
188
+ readonly installed: string;
189
+ readonly latest?: string;
190
+ readonly running?: string;
191
+ readonly local?: boolean;
192
+ }
193
+
194
+ export interface ModuleVersionsPayload {
195
+ readonly modules: readonly ModuleVersion[];
196
+ readonly workbench?: WorkbenchVersion;
197
+ readonly selfUpdate?: WorkbenchSelfUpdate;
198
+ }
@@ -0,0 +1,65 @@
1
+ export const CONFIG_SYNC_ROUTE = 'config-sync';
2
+
3
+ export const CONFIG_SYNC_RESOURCE = 'configSync';
4
+
5
+ export type ConfigSyncState = 'new' | 'differs' | 'same';
6
+
7
+ export type ConfigSyncAssetState = 'missing' | 'differs' | 'same' | 'external';
8
+
9
+ export interface ConfigSyncAssetFile {
10
+ readonly path: string;
11
+ readonly state: ConfigSyncAssetState;
12
+ readonly bytes: number | null;
13
+ }
14
+
15
+ export interface ConfigSyncAsset {
16
+ readonly key: string;
17
+ readonly path: string;
18
+ readonly kind: 'file' | 'dir';
19
+ readonly state: ConfigSyncAssetState;
20
+ readonly files: readonly ConfigSyncAssetFile[];
21
+ readonly bytes: number;
22
+ readonly reason?: string;
23
+ }
24
+
25
+ export interface ConfigSyncRow {
26
+ readonly key: string;
27
+ readonly id: string;
28
+ readonly insert: boolean;
29
+ readonly state: ConfigSyncState;
30
+ readonly body: string;
31
+ readonly ownBody: string | null;
32
+ readonly missing: readonly string[];
33
+ readonly assets: readonly ConfigSyncAsset[];
34
+ }
35
+
36
+ export interface ConfigSyncProfile {
37
+ readonly name: string;
38
+ readonly readable: boolean;
39
+ readonly candidates: number;
40
+ }
41
+
42
+ export interface ConfigSyncSnapshot {
43
+ readonly self: string;
44
+ readonly home: string;
45
+ readonly source: string;
46
+ readonly profiles: readonly ConfigSyncProfile[];
47
+ readonly rows: readonly ConfigSyncRow[];
48
+ readonly emptyProviders: boolean;
49
+ readonly reason?: string;
50
+ }
51
+
52
+ export interface ConfigSyncApplied {
53
+ readonly written: readonly string[];
54
+ readonly skipped: readonly string[];
55
+ readonly files: readonly string[];
56
+ readonly verified: boolean;
57
+ }
58
+
59
+ export interface ConfigSyncRequest {
60
+ readonly source: string;
61
+ readonly keys: readonly string[];
62
+ readonly overwrite: readonly string[];
63
+ readonly assets?: readonly string[];
64
+ readonly overwriteAssets?: readonly string[];
65
+ }
@@ -0,0 +1,4 @@
1
+ export const DIY_PRESET_ID = 'workbench-diy';
2
+ export const WORKSHOP_RELATIVE = 'workbench/diy';
3
+ export const WORKSHOP_TITLE = '工作台DIY';
4
+ export const WORKSHOP_PAST_TITLES: readonly string[] = ['DIY 工坊', '工作台自带 · DIY 模块住这儿'];
@@ -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
+ }
@@ -0,0 +1,23 @@
1
+ import type { ModuleBlocker } from './blocker.js';
2
+
3
+ /**
4
+ * 卡片闸的两种档:capability 按环境读数判,none 无条件放行。
5
+ */
6
+ export type GateMode =
7
+ | 'capability'
8
+ | 'none';
9
+
10
+ /**
11
+ * 一次放行判定的结果;gated 为假时卡片不画。
12
+ */
13
+ export interface UnitGate {
14
+ readonly gated: boolean;
15
+ }
16
+
17
+ /**
18
+ * 一个单元攒下的卡住态:blocker 顶掉卡片,notice 只提示;组装方产出,卡片消费。
19
+ */
20
+ export interface UnitBlockers {
21
+ readonly blocker?: ModuleBlocker;
22
+ readonly notice?: ModuleBlocker;
23
+ }