@dsh-workbench/shared 1.5.2-alpha.4 → 1.5.2-rc.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 (344) hide show
  1. package/dist/components/Activity.css +69 -0
  2. package/dist/components/Activity.d.ts +56 -0
  3. package/dist/components/Activity.js +47 -0
  4. package/dist/components/ApprovalDetail.css +3 -0
  5. package/dist/components/ApprovalDetail.d.ts +42 -0
  6. package/dist/components/ApprovalDetail.js +53 -0
  7. package/dist/components/ApprovalPlan.css +39 -0
  8. package/dist/components/ApprovalPlan.d.ts +27 -0
  9. package/dist/components/ApprovalPlan.js +19 -0
  10. package/dist/components/Card.css +19 -0
  11. package/dist/components/Card.d.ts +26 -0
  12. package/dist/components/Card.js +18 -0
  13. package/dist/components/CardAnchor.d.ts +21 -0
  14. package/dist/components/CardAnchor.js +19 -0
  15. package/dist/components/CardAnchor.module.css +3 -0
  16. package/dist/components/CardBoundary.d.ts +42 -0
  17. package/dist/components/CardBoundary.js +58 -0
  18. package/dist/components/CardBoundary.module.css +5 -0
  19. package/dist/components/CardHead.css +87 -0
  20. package/dist/components/CardHead.d.ts +30 -0
  21. package/dist/components/CardHead.js +27 -0
  22. package/dist/components/ChoiceGroup.css +182 -0
  23. package/dist/components/ChoiceGroup.d.ts +54 -0
  24. package/dist/components/ChoiceGroup.js +63 -0
  25. package/dist/components/ConfirmBar.css +26 -0
  26. package/dist/components/ConfirmBar.d.ts +36 -0
  27. package/dist/components/ConfirmBar.js +26 -0
  28. package/dist/components/EmptyIllustration.d.ts +12 -0
  29. package/dist/components/EmptyIllustration.js +32 -0
  30. package/dist/components/Field.css +20 -0
  31. package/dist/components/Field.d.ts +18 -0
  32. package/dist/components/Field.js +15 -0
  33. package/dist/components/Form.css +6 -0
  34. package/dist/components/Form.d.ts +22 -0
  35. package/dist/components/Form.js +60 -0
  36. package/dist/components/FormActions.css +13 -0
  37. package/dist/components/FormActions.d.ts +29 -0
  38. package/dist/components/FormActions.js +43 -0
  39. package/dist/components/FormNodes.d.ts +107 -0
  40. package/dist/components/FormNodes.js +165 -0
  41. package/dist/components/FormRows.css +107 -0
  42. package/dist/components/FormRows.d.ts +36 -0
  43. package/dist/components/FormRows.js +26 -0
  44. package/dist/components/FormTypes.d.ts +84 -0
  45. package/dist/components/FormTypes.js +1 -0
  46. package/dist/components/Link.css +22 -0
  47. package/dist/components/Link.d.ts +22 -0
  48. package/dist/components/Link.js +17 -0
  49. package/dist/components/LongTaskRow.css +171 -0
  50. package/dist/components/LongTaskRow.d.ts +94 -0
  51. package/dist/components/LongTaskRow.js +103 -0
  52. package/dist/components/Note.css +13 -0
  53. package/dist/components/Note.d.ts +20 -0
  54. package/dist/components/Note.js +14 -0
  55. package/dist/components/ResourceStates.css +114 -0
  56. package/dist/components/ResourceStates.d.ts +44 -0
  57. package/dist/components/ResourceStates.js +41 -0
  58. package/dist/components/Rows.css +42 -0
  59. package/dist/components/Rows.d.ts +28 -0
  60. package/dist/components/Rows.js +21 -0
  61. package/dist/components/SaveBar.d.ts +24 -0
  62. package/dist/components/SaveBar.js +25 -0
  63. package/dist/components/SelectField.css +182 -0
  64. package/dist/components/SelectField.d.ts +89 -0
  65. package/dist/components/SelectField.js +260 -0
  66. package/dist/components/SelectFieldNodes.d.ts +49 -0
  67. package/dist/components/SelectFieldNodes.js +43 -0
  68. package/dist/components/SettingsSection.css +25 -0
  69. package/dist/components/SettingsSection.d.ts +20 -0
  70. package/dist/components/SettingsSection.js +17 -0
  71. package/dist/components/SetupShell.d.ts +93 -0
  72. package/dist/components/SetupShell.js +64 -0
  73. package/dist/components/SetupShell.module.css +81 -0
  74. package/dist/components/Spinner.css +5 -0
  75. package/dist/components/Spinner.d.ts +15 -0
  76. package/dist/components/Spinner.js +13 -0
  77. package/dist/components/Stack.css +6 -0
  78. package/dist/components/Stack.d.ts +14 -0
  79. package/dist/components/Stack.js +10 -0
  80. package/dist/components/StateBlock.css +38 -0
  81. package/dist/components/StateBlock.d.ts +24 -0
  82. package/dist/components/StateBlock.js +22 -0
  83. package/dist/components/TextField.css +32 -0
  84. package/dist/components/TextField.d.ts +14 -0
  85. package/dist/components/TextField.js +10 -0
  86. package/dist/components/board-module.d.ts +307 -0
  87. package/dist/components/board-module.js +1 -0
  88. package/dist/components/card-view-validate.d.ts +5 -0
  89. package/dist/components/card-view-validate.js +256 -0
  90. package/dist/components/icons.d.ts +63 -0
  91. package/dist/components/icons.js +107 -0
  92. package/dist/components/layout/icon-command.d.ts +8 -0
  93. package/dist/components/layout/icon-command.js +21 -0
  94. package/dist/contract/capture.d.ts +16 -0
  95. package/dist/contract/capture.js +1 -0
  96. package/dist/contract/diagnostics.d.ts +34 -0
  97. package/dist/contract/diagnostics.js +124 -0
  98. package/dist/contract/needs.d.ts +3 -1
  99. package/dist/contract/needs.js +4 -2
  100. package/dist/contract/protocol/bundle-install.d.ts +1 -1
  101. package/dist/contract/protocol/unit-manager.d.ts +50 -0
  102. package/dist/contract/protocol/unit-manager.js +2 -0
  103. package/dist/contract/unit.js +2 -1
  104. package/dist/host/adapter-contract.d.ts +3 -0
  105. package/dist/host/adapter-contract.js +95 -0
  106. package/dist/host/adapter-set.d.ts +27 -0
  107. package/dist/host/adapter-set.js +258 -0
  108. package/dist/host/adapter-types.d.ts +87 -0
  109. package/dist/host/adapter-types.js +23 -0
  110. package/dist/host/adapters/platform.d.ts +14 -0
  111. package/dist/host/adapters/platform.js +40 -0
  112. package/dist/host/adapters.d.ts +28 -0
  113. package/dist/host/adapters.js +9 -0
  114. package/dist/host/auth-loss.d.ts +33 -0
  115. package/dist/host/auth-loss.js +107 -0
  116. package/dist/host/board-fact.d.ts +8 -0
  117. package/dist/host/board-fact.js +16 -0
  118. package/dist/host/boot-record.d.ts +11 -0
  119. package/dist/host/boot-record.js +31 -0
  120. package/dist/host/browser.d.ts +3 -0
  121. package/dist/host/browser.js +3 -0
  122. package/dist/host/bundle-manager.d.ts +4 -0
  123. package/dist/host/bundle-manager.js +338 -0
  124. package/dist/host/changelog.d.ts +28 -0
  125. package/dist/host/changelog.js +201 -0
  126. package/dist/host/cli-error.d.ts +8 -0
  127. package/dist/host/cli-error.js +70 -0
  128. package/dist/host/cli.d.ts +4 -0
  129. package/dist/host/cli.js +9 -0
  130. package/dist/host/config-sync.d.ts +40 -0
  131. package/dist/host/config-sync.js +267 -0
  132. package/dist/host/context-ref.d.ts +13 -0
  133. package/dist/host/context-ref.js +41 -0
  134. package/dist/host/data-error.d.ts +15 -0
  135. package/dist/host/data-error.js +23 -0
  136. package/dist/host/data-plan-check.d.ts +10 -0
  137. package/dist/host/data-plan-check.js +315 -0
  138. package/dist/host/data-plan.d.ts +15 -0
  139. package/dist/host/data-plan.js +283 -0
  140. package/dist/host/data-root.d.ts +5 -0
  141. package/dist/host/data-root.js +23 -0
  142. package/dist/host/diy-debug.d.ts +80 -0
  143. package/dist/host/diy-debug.js +89 -0
  144. package/dist/host/diy-preset.d.ts +26 -0
  145. package/dist/host/diy-preset.js +115 -0
  146. package/dist/host/diy-record.d.ts +135 -0
  147. package/dist/host/diy-record.js +163 -0
  148. package/dist/host/dsh-compat.d.ts +27 -0
  149. package/dist/host/dsh-compat.js +75 -0
  150. package/dist/host/dsh-plugins.d.ts +5 -0
  151. package/dist/host/dsh-plugins.js +51 -0
  152. package/dist/host/env-policy.d.ts +82 -0
  153. package/dist/host/env-policy.js +181 -0
  154. package/dist/host/extension.d.ts +7 -0
  155. package/dist/host/extension.js +40 -0
  156. package/dist/host/facts.d.ts +31 -0
  157. package/dist/host/facts.js +58 -0
  158. package/dist/host/fs-write.d.ts +96 -0
  159. package/dist/host/fs-write.js +183 -0
  160. package/dist/host/git.d.ts +5 -0
  161. package/dist/host/git.js +1 -0
  162. package/dist/host/host-actions.d.ts +2 -0
  163. package/dist/host/host-actions.js +5 -0
  164. package/dist/host/host-kit.d.ts +37 -0
  165. package/dist/host/host-kit.js +27 -0
  166. package/dist/host/http.d.ts +47 -0
  167. package/dist/host/http.js +289 -0
  168. package/dist/host/install-failure.d.ts +50 -0
  169. package/dist/host/install-failure.js +184 -0
  170. package/dist/host/installed-module.d.ts +25 -0
  171. package/dist/host/installed-module.js +289 -0
  172. package/dist/host/installed-sources.d.ts +10 -0
  173. package/dist/host/installed-sources.js +63 -0
  174. package/dist/host/lease.d.ts +70 -0
  175. package/dist/host/lease.js +264 -0
  176. package/dist/host/lib-capabilities.d.ts +22 -0
  177. package/dist/host/lib-capabilities.js +37 -0
  178. package/dist/host/lib-install.d.ts +19 -0
  179. package/dist/host/lib-install.js +40 -0
  180. package/dist/host/lib-runners.d.ts +18 -0
  181. package/dist/host/lib-runners.js +46 -0
  182. package/dist/host/local-declaration.d.ts +7 -0
  183. package/dist/host/local-declaration.js +33 -0
  184. package/dist/host/long-task.d.ts +97 -0
  185. package/dist/host/long-task.js +297 -0
  186. package/dist/host/market-index-claim.d.ts +19 -0
  187. package/dist/host/market-index-claim.js +87 -0
  188. package/dist/host/market-index-doc.d.ts +12 -0
  189. package/dist/host/market-index-doc.js +1 -0
  190. package/dist/host/market-index-parse.d.ts +28 -0
  191. package/dist/host/market-index-parse.js +413 -0
  192. package/dist/host/market-index.d.ts +13 -0
  193. package/dist/host/market-index.js +105 -0
  194. package/dist/host/module-root.d.ts +1 -0
  195. package/dist/host/module-root.js +5 -0
  196. package/dist/host/needs.d.ts +4 -0
  197. package/dist/host/needs.js +2 -0
  198. package/dist/host/npm-registry.d.ts +10 -0
  199. package/dist/host/npm-registry.js +16 -0
  200. package/dist/host/package-content.d.ts +8 -0
  201. package/dist/host/package-content.js +90 -0
  202. package/dist/host/package-kind.d.ts +13 -0
  203. package/dist/host/package-kind.js +51 -0
  204. package/dist/host/package-route.d.ts +33 -0
  205. package/dist/host/package-route.js +68 -0
  206. package/dist/host/panel-state.d.ts +120 -0
  207. package/dist/host/panel-state.js +177 -0
  208. package/dist/host/patch-blocks.d.ts +13 -0
  209. package/dist/host/patch-blocks.js +52 -0
  210. package/dist/host/patch.d.ts +4 -0
  211. package/dist/host/patch.js +7 -0
  212. package/dist/host/paths.d.ts +12 -0
  213. package/dist/host/paths.js +20 -0
  214. package/dist/host/payload.d.ts +12 -0
  215. package/dist/host/payload.js +16 -0
  216. package/dist/host/plan-results.d.ts +5 -0
  217. package/dist/host/plan-results.js +71 -0
  218. package/dist/host/plan-run.d.ts +41 -0
  219. package/dist/host/plan-run.js +87 -0
  220. package/dist/host/platform.d.ts +14 -0
  221. package/dist/host/platform.js +40 -0
  222. package/dist/host/plugin-ledger.d.ts +32 -0
  223. package/dist/host/plugin-ledger.js +106 -0
  224. package/dist/host/plugin.d.ts +3 -0
  225. package/dist/host/plugin.js +38 -0
  226. package/dist/host/port-types.d.ts +233 -0
  227. package/dist/host/port-types.js +1 -0
  228. package/dist/host/preflight.d.ts +32 -0
  229. package/dist/host/preflight.js +1 -0
  230. package/dist/host/process-alive.d.ts +6 -0
  231. package/dist/host/process-alive.js +16 -0
  232. package/dist/host/profile-bundles.d.ts +20 -0
  233. package/dist/host/profile-bundles.js +48 -0
  234. package/dist/host/profile-create.d.ts +19 -0
  235. package/dist/host/profile-create.js +124 -0
  236. package/dist/host/profile-port.d.ts +4 -0
  237. package/dist/host/profile-port.js +4 -0
  238. package/dist/host/profile-registries.d.ts +10 -0
  239. package/dist/host/profile-registries.js +149 -0
  240. package/dist/host/provision.d.ts +32 -0
  241. package/dist/host/provision.js +105 -0
  242. package/dist/host/read-json.d.ts +1 -0
  243. package/dist/host/read-json.js +11 -0
  244. package/dist/host/recipe-rules.d.ts +5 -0
  245. package/dist/host/recipe-rules.js +412 -0
  246. package/dist/host/recipe.d.ts +14 -0
  247. package/dist/host/recipe.js +332 -0
  248. package/dist/host/registry-declaration.d.ts +21 -0
  249. package/dist/host/registry-declaration.js +42 -0
  250. package/dist/host/reinstall-record.d.ts +16 -0
  251. package/dist/host/reinstall-record.js +54 -0
  252. package/dist/host/release-age.d.ts +24 -0
  253. package/dist/host/release-age.js +92 -0
  254. package/dist/host/release-packages.generated.d.ts +1 -0
  255. package/dist/host/release-packages.generated.js +10 -0
  256. package/dist/host/release-probe.d.ts +37 -0
  257. package/dist/host/release-probe.js +156 -0
  258. package/dist/host/runtime/browser-argv.d.ts +1 -0
  259. package/dist/host/runtime/browser-argv.js +9 -0
  260. package/dist/host/runtime/dsh-compat.d.ts +4 -0
  261. package/dist/host/runtime/dsh-compat.js +32 -16
  262. package/dist/host/runtime/front-app.d.ts +6 -0
  263. package/dist/host/runtime/front-app.js +70 -0
  264. package/dist/host/runtime/verified-dsh.d.ts +5 -0
  265. package/dist/host/runtime/verified-dsh.js +20 -0
  266. package/dist/host/shell-render.d.ts +52 -0
  267. package/dist/host/shell-render.js +117 -0
  268. package/dist/host/shell-text.d.ts +30 -0
  269. package/dist/host/shell-text.js +40 -0
  270. package/dist/host/shell.d.ts +25 -0
  271. package/dist/host/shell.js +55 -0
  272. package/dist/host/site.d.ts +45 -0
  273. package/dist/host/site.js +182 -0
  274. package/dist/host/spec.d.ts +8 -0
  275. package/dist/host/spec.js +24 -0
  276. package/dist/host/submit-confirm.d.ts +19 -0
  277. package/dist/host/submit-confirm.js +45 -0
  278. package/dist/host/supply/builtin-catalog.d.ts +3 -0
  279. package/dist/host/supply/builtin-catalog.js +38 -0
  280. package/dist/host/supply/preflight.d.ts +14 -1
  281. package/dist/host/supply/supply-index.js +6 -0
  282. package/dist/host/supply-index.d.ts +38 -0
  283. package/dist/host/supply-index.js +209 -0
  284. package/dist/host/supply-port.d.ts +5 -0
  285. package/dist/host/supply-port.js +50 -0
  286. package/dist/host/time.d.ts +22 -0
  287. package/dist/host/time.js +33 -0
  288. package/dist/host/tokens.d.ts +26 -0
  289. package/dist/host/tokens.js +154 -0
  290. package/dist/host/tool-approval.d.ts +86 -0
  291. package/dist/host/tool-approval.js +118 -0
  292. package/dist/host/tool-kit.d.ts +8 -0
  293. package/dist/host/tool-kit.js +22 -0
  294. package/dist/host/toolbox-port.d.ts +16 -0
  295. package/dist/host/toolbox-port.js +1 -0
  296. package/dist/host/unit-config.d.ts +34 -0
  297. package/dist/host/unit-config.js +28 -0
  298. package/dist/host/unit-data.d.ts +3 -0
  299. package/dist/host/unit-data.js +127 -0
  300. package/dist/host/unit-face.d.ts +95 -0
  301. package/dist/host/unit-face.js +1 -0
  302. package/dist/host/unit-plugin.d.ts +24 -0
  303. package/dist/host/unit-plugin.js +25 -0
  304. package/dist/host/update-journal-manifest.d.ts +19 -0
  305. package/dist/host/update-journal-manifest.js +134 -0
  306. package/dist/host/update-journal-types.d.ts +33 -0
  307. package/dist/host/update-journal-types.js +2 -0
  308. package/dist/host/update-journal.d.ts +43 -0
  309. package/dist/host/update-journal.js +409 -0
  310. package/dist/host/value-handoff.d.ts +16 -0
  311. package/dist/host/value-handoff.js +22 -0
  312. package/dist/host/version-range.d.ts +2 -0
  313. package/dist/host/version-range.js +13 -0
  314. package/dist/host/version.d.ts +4 -0
  315. package/dist/host/version.js +32 -0
  316. package/dist/host/workspace-store.d.ts +19 -0
  317. package/dist/host/workspace-store.js +133 -0
  318. package/dist/host/write-result.d.ts +1 -0
  319. package/dist/host/write-result.js +18 -0
  320. package/dist/host.d.ts +2 -0
  321. package/dist/host.js +2 -0
  322. package/dist/i18n/en.js +14 -3
  323. package/dist/i18n/index.d.ts +15 -4
  324. package/dist/i18n/zh.d.ts +14 -3
  325. package/dist/i18n/zh.js +14 -3
  326. package/dist/lib/bundle-requirements.d.ts +1 -0
  327. package/dist/lib/bundle-requirements.js +9 -0
  328. package/package.json +1 -1
  329. package/src/contract/__tests__/unit.test.ts +7 -0
  330. package/src/contract/needs.ts +5 -3
  331. package/src/contract/protocol/bundle-install.ts +1 -0
  332. package/src/contract/unit.ts +2 -1
  333. package/src/host/runtime/__tests__/dsh-compat.test.ts +19 -1
  334. package/src/host/runtime/__tests__/verified-dsh.test.ts +55 -0
  335. package/src/host/runtime/dsh-compat.ts +36 -12
  336. package/src/host/runtime/verified-dsh.ts +22 -0
  337. package/src/host/supply/__tests__/builtin-catalog.test.ts +44 -0
  338. package/src/host/supply/builtin-catalog.ts +38 -0
  339. package/src/host/supply/preflight.ts +16 -1
  340. package/src/host/supply/supply-index.ts +3 -0
  341. package/src/host.ts +2 -0
  342. package/src/i18n/en.ts +17 -3
  343. package/src/i18n/zh.ts +16 -3
  344. package/src/lib/bundle-requirements.ts +11 -0
@@ -0,0 +1,71 @@
1
+ const CODE_MAP = {
2
+ 'not-logged-in': 'auth',
3
+ forbidden: 'permission-denied',
4
+ 'not-on-site': 'browser',
5
+ http: 'http',
6
+ 'fetch-failed': 'browser',
7
+ 'too-large': 'parse',
8
+ shape: 'parse',
9
+ parse: 'parse',
10
+ 'ref-missing': 'parse',
11
+ 'path-missing': 'parse',
12
+ 'too-many-steps': 'invalid-request',
13
+ 'too-many-iterations': 'invalid-request',
14
+ 'repeat-invalid': 'invalid-request',
15
+ aborted: 'aborted',
16
+ timeout: 'timeout',
17
+ };
18
+ function stepError(one, loginUrl) {
19
+ const pageCode = typeof one['code'] === 'string' ? one['code'] : 'shape';
20
+ const mapped = CODE_MAP[pageCode];
21
+ const code = mapped ?? (pageCode === 'auth' || pageCode === 'http' || pageCode === 'timeout' ? pageCode : 'browser');
22
+ return {
23
+ code,
24
+ message: typeof one['message'] === 'string' ? one['message'] : '这一步没读成',
25
+ pageCode,
26
+ ...(typeof one['hint'] === 'string' && one['hint'] !== '' ? { hint: one['hint'] } : {}),
27
+ ...(code === 'auth' && loginUrl !== undefined ? { helpUrl: loginUrl } : {}),
28
+ };
29
+ }
30
+ function elapsedOf(one) {
31
+ return typeof one['elapsedMs'] === 'number' ? { elapsedMs: one['elapsedMs'] } : {};
32
+ }
33
+ export function planResultsOf(value, names = [], options = {}) {
34
+ const raw = (value ?? {});
35
+ const out = Object.create(null);
36
+ if (raw['ok'] === false) {
37
+ const one = stepError(raw, options.loginUrl);
38
+ for (const name of names)
39
+ out[name] = { ok: false, error: one, ...elapsedOf(raw) };
40
+ return out;
41
+ }
42
+ const steps = (raw['steps'] ?? {});
43
+ for (const [name, one] of Object.entries(steps)) {
44
+ out[name] =
45
+ one['ok'] === true
46
+ ? {
47
+ ok: true,
48
+ data: one['value'],
49
+ ...elapsedOf(one),
50
+ }
51
+ : { ok: false, error: stepError(one, options.loginUrl), ...elapsedOf(one) };
52
+ }
53
+ for (const name of names) {
54
+ if (Object.hasOwn(out, name))
55
+ continue;
56
+ out[name] = {
57
+ ok: false,
58
+ error: { code: 'skipped', message: '前面某一步没成,这一步没跑', pageCode: 'skipped' },
59
+ };
60
+ }
61
+ return out;
62
+ }
63
+ export function allSame(plan, error) {
64
+ return Object.fromEntries(namedSteps(plan).map((one) => [one, { ok: false, error }]));
65
+ }
66
+ function namedSteps(plan) {
67
+ const steps = Array.isArray(plan?.steps) ? plan.steps : [];
68
+ return steps
69
+ .map((one) => (typeof one === 'object' && one !== null && typeof one.name === 'string' ? one.name : ''))
70
+ .filter((name) => name !== '');
71
+ }
@@ -0,0 +1,41 @@
1
+ import type { PluginPlanStep } from '../contract/plugin-source.js';
2
+ import type { ExecIntent } from './seam/exec.js';
3
+ import type { Seam } from './seam/run.js';
4
+ export interface PlanRunDeps {
5
+ readonly seam: Seam;
6
+ readonly intent: ExecIntent;
7
+ readonly timeoutMs?: number | undefined;
8
+ readonly check?: ((step: PluginPlanStep) => void) | undefined;
9
+ }
10
+ export type HostRunStep = Extract<PluginPlanStep, {
11
+ readonly kind: 'run';
12
+ }> & {
13
+ readonly host: true;
14
+ };
15
+ /**
16
+ * 把一条命令步标成改走宿主通道:这一步自己还要再起子进程,沙箱里的进程再 spawn 会被 Windows 拒(EPERM)。
17
+ * 只有确认「非它不可」时才标;标了这一步就不受沙箱保护,产品域 env 照旧。
18
+ * @param step - 一条命令步(照旧带 line / env / optional)。
19
+ * @returns 同一一步,多了 `host` 标记,交给 `runPlan` 走宿主通道。
20
+ */
21
+ export declare function hostCommandStep(step: Extract<PluginPlanStep, {
22
+ readonly kind: 'run';
23
+ }>): HostRunStep;
24
+ /**
25
+ * 安装计划里某一步没跑成:带上那条命令、退出码与输出,交给调用点做诊断。
26
+ */
27
+ export declare class PlanStepError extends Error {
28
+ readonly step: PluginPlanStep;
29
+ readonly exitCode: number | null;
30
+ readonly output: string;
31
+ constructor(step: PluginPlanStep, exitCode: number | null, output: string);
32
+ }
33
+ /**
34
+ * 按顺序跑完一个安装计划:命令走执行缝,文件操作走宿主文件入口(`node:fs`,不经过 shell)。
35
+ * 带 `host` 标记的命令步改走宿主通道(免沙箱),其余按 `deps.intent` 走沙箱。
36
+ * `optional` 只豁免「命令非零退出」,执行缝自己抛的错(沙箱拒绝一类)照旧冒出去。
37
+ * @param steps - 计划步骤。
38
+ * @param deps - 执行缝、写入域、超时,以及每一步的前置检查。
39
+ * @returns 全部步骤完成。
40
+ */
41
+ export declare function runPlan(steps: readonly PluginPlanStep[], deps: PlanRunDeps): Promise<void>;
@@ -0,0 +1,87 @@
1
+ import { copyDirInto, ensureDir, linkDir, removePath } from './fs-write.js';
2
+ import { workbenchRoot } from './data-root.js';
3
+ import { seamProductEnv } from './seam/env.js';
4
+ import { planStepText } from './shell-render.js';
5
+ /**
6
+ * 把一条命令步标成改走宿主通道:这一步自己还要再起子进程,沙箱里的进程再 spawn 会被 Windows 拒(EPERM)。
7
+ * 只有确认「非它不可」时才标;标了这一步就不受沙箱保护,产品域 env 照旧。
8
+ * @param step - 一条命令步(照旧带 line / env / optional)。
9
+ * @returns 同一一步,多了 `host` 标记,交给 `runPlan` 走宿主通道。
10
+ */
11
+ export function hostCommandStep(step) {
12
+ return { ...step, host: true };
13
+ }
14
+ function isHostStep(step) {
15
+ return 'host' in step && step.host === true;
16
+ }
17
+ function envOf(step, seam) {
18
+ if (!isHostStep(step))
19
+ return step.env;
20
+ return { ...seamProductEnv({ runtimeRoot: seam.runtimeRoot ?? workbenchRoot() }), ...(step.env ?? {}) };
21
+ }
22
+ /**
23
+ * 安装计划里某一步没跑成:带上那条命令、退出码与输出,交给调用点做诊断。
24
+ */
25
+ export class PlanStepError extends Error {
26
+ step;
27
+ exitCode;
28
+ output;
29
+ constructor(step, exitCode, output) {
30
+ super(`计划里这一步没跑成(退出码 ${exitCode === null ? '拿不到' : String(exitCode)}):${planStepText(step)}`);
31
+ this.name = 'PlanStepError';
32
+ this.step = step;
33
+ this.exitCode = exitCode;
34
+ this.output = output;
35
+ }
36
+ }
37
+ function applyFileStep(step) {
38
+ if (step.kind === 'remove') {
39
+ removePath(step.path);
40
+ return;
41
+ }
42
+ if (step.kind === 'mkdir') {
43
+ ensureDir(step.path);
44
+ return;
45
+ }
46
+ if (step.kind === 'link') {
47
+ linkDir(step.target, step.path);
48
+ return;
49
+ }
50
+ copyDirInto(step.from, step.to);
51
+ }
52
+ async function runCommandStep(step, deps) {
53
+ const env = envOf(step, deps.seam);
54
+ const outcome = await deps.seam.run({
55
+ command: step.line,
56
+ intent: isHostStep(step) ? { kind: 'host' } : deps.intent,
57
+ ...(deps.timeoutMs === undefined ? {} : { timeoutMs: deps.timeoutMs }),
58
+ ...(env === undefined ? {} : { env }),
59
+ });
60
+ if (step.optional === true)
61
+ return;
62
+ if (outcome.exitCode !== 0)
63
+ throw new PlanStepError(step, outcome.exitCode, outcome.stderr || outcome.stdout);
64
+ }
65
+ /**
66
+ * 按顺序跑完一个安装计划:命令走执行缝,文件操作走宿主文件入口(`node:fs`,不经过 shell)。
67
+ * 带 `host` 标记的命令步改走宿主通道(免沙箱),其余按 `deps.intent` 走沙箱。
68
+ * `optional` 只豁免「命令非零退出」,执行缝自己抛的错(沙箱拒绝一类)照旧冒出去。
69
+ * @param steps - 计划步骤。
70
+ * @param deps - 执行缝、写入域、超时,以及每一步的前置检查。
71
+ * @returns 全部步骤完成。
72
+ */
73
+ export async function runPlan(steps, deps) {
74
+ for (const step of steps) {
75
+ deps.check?.(step);
76
+ if (step.kind === 'run') {
77
+ await runCommandStep(step, deps);
78
+ continue;
79
+ }
80
+ try {
81
+ applyFileStep(step);
82
+ }
83
+ catch (error) {
84
+ throw new PlanStepError(step, null, error instanceof Error ? error.message : String(error));
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,14 @@
1
+ import type { HostOs, HostSurface, ProfileName } from '../contract/protocol/platform.js';
2
+ export interface HostSurfaceInput {
3
+ readonly proc?: {
4
+ readonly versions: {
5
+ readonly electron?: string | undefined;
6
+ readonly node?: string | undefined;
7
+ };
8
+ };
9
+ readonly profile?: string | undefined;
10
+ readonly platform?: NodeJS.Platform | undefined;
11
+ }
12
+ export declare function profileNameOf(raw: string | undefined): ProfileName;
13
+ export declare function hostOsOf(platform: NodeJS.Platform): HostOs;
14
+ export declare function hostSurface(input?: HostSurfaceInput): HostSurface;
@@ -0,0 +1,40 @@
1
+ export function profileNameOf(raw) {
2
+ const name = (raw ?? '').split(/[\\/]/).pop()?.toLowerCase() ?? '';
3
+ if (name === 'desktop' || name === 'web' || name === 'workbench' || name === 'headless')
4
+ return name;
5
+ return 'other';
6
+ }
7
+ export function hostOsOf(platform) {
8
+ if (platform === 'darwin' || platform === 'win32' || platform === 'linux')
9
+ return platform;
10
+ return 'other';
11
+ }
12
+ export function hostSurface(input = {}) {
13
+ const proc = input.proc ?? process;
14
+ const runtime = proc.versions.electron === undefined ? 'node' : 'electron';
15
+ const deployment = runtime === 'electron' ? 'desktop' : 'web';
16
+ const profile = profileNameOf(input.profile);
17
+ const hostOs = hostOsOf(input.platform ?? process.platform);
18
+ const pageDebug = deployment !== 'desktop';
19
+ const selfUpdateCli = profile === 'desktop' ? 'desktop-cli' : 'path-dsh';
20
+ return {
21
+ deployment,
22
+ hostOs,
23
+ runtime,
24
+ profile,
25
+ capabilities: {
26
+ pageDebug,
27
+ siteExplore: true,
28
+ recording: true,
29
+ browserWake: deployment === 'desktop',
30
+ selfUpdateCli,
31
+ safeMode: deployment === 'desktop',
32
+ },
33
+ restartHint: deployment === 'desktop' ? '退出并重开 Desktop' : '重启一次 dsh',
34
+ toolchain: {
35
+ node: { source: deployment === 'desktop' ? 'desktop-shim' : 'path' },
36
+ npm: { neededFor: 'runtime-install' },
37
+ pnpm: { neededFor: 'workshop', expectedMajor: 10 },
38
+ },
39
+ };
40
+ }
@@ -0,0 +1,32 @@
1
+ import type { ModuleStore } from './workspace-store.js';
2
+ export declare const PLUGIN_LEDGER_FILE = "plugins.json";
3
+ export interface PluginLedgerEntry {
4
+ readonly home: string;
5
+ readonly package: string;
6
+ readonly name?: string;
7
+ readonly registry?: string;
8
+ readonly local?: boolean;
9
+ readonly installedAt: string;
10
+ readonly releasedAt?: string;
11
+ }
12
+ export declare function ledgerKeyOf(entry: {
13
+ readonly home: string;
14
+ readonly package: string;
15
+ }): string;
16
+ export declare function parsePluginLedger(raw: unknown): PluginLedgerEntry[];
17
+ export declare function readPluginLedger(store: ModuleStore): PluginLedgerEntry[];
18
+ export declare function writePluginLedger(store: ModuleStore, entries: readonly PluginLedgerEntry[]): void;
19
+ export declare function pluginEntriesOfHome(entries: readonly PluginLedgerEntry[], home: string): PluginLedgerEntry[];
20
+ export declare function isHeldEntry(entry: PluginLedgerEntry): boolean;
21
+ export declare function heldEntriesOfHome(entries: readonly PluginLedgerEntry[], home: string): PluginLedgerEntry[];
22
+ export declare function heldEntryOfPlugin(entries: readonly PluginLedgerEntry[], home: string, plugin: string): PluginLedgerEntry | undefined;
23
+ export declare function withReleasedEntry(entries: readonly PluginLedgerEntry[], home: string, pkg: string, releasedAt: string): PluginLedgerEntry[];
24
+ export type PluginRetention = 'remove' | 'keep-held' | 'keep-claimed' | 'keep-unsure';
25
+ export declare function pluginRetentionOf(options: {
26
+ readonly held: boolean;
27
+ readonly claimedBy: readonly string[];
28
+ readonly trustworthy: boolean;
29
+ }): PluginRetention;
30
+ export declare function pluginEntryOf(entries: readonly PluginLedgerEntry[], home: string, pkg: string): PluginLedgerEntry | undefined;
31
+ export declare function withPluginEntry(entries: readonly PluginLedgerEntry[], entry: PluginLedgerEntry): PluginLedgerEntry[];
32
+ export declare function withoutPluginEntry(entries: readonly PluginLedgerEntry[], home: string, pkg: string): PluginLedgerEntry[];
@@ -0,0 +1,106 @@
1
+ export const PLUGIN_LEDGER_FILE = 'plugins.json';
2
+ export function ledgerKeyOf(entry) {
3
+ return `${entry.home}\u0000${entry.package}`;
4
+ }
5
+ function textOf(value) {
6
+ if (typeof value !== 'string')
7
+ return undefined;
8
+ const trimmed = value.trim();
9
+ return trimmed === '' ? undefined : trimmed;
10
+ }
11
+ function legacyHomeOf(box) {
12
+ for (const [key, value] of Object.entries(box)) {
13
+ if (key !== 'home' && key.toLowerCase().endsWith('home'))
14
+ return value;
15
+ }
16
+ return undefined;
17
+ }
18
+ function entryOf(value) {
19
+ if (typeof value !== 'object' || value === null)
20
+ return undefined;
21
+ const box = value;
22
+ const home = textOf(box['home']) ?? textOf(legacyHomeOf(box));
23
+ const pkg = textOf(box['package']);
24
+ const installedAt = textOf(box['installedAt']);
25
+ if (home === undefined || pkg === undefined || installedAt === undefined)
26
+ return undefined;
27
+ const name = textOf(box['name']);
28
+ const registry = textOf(box['registry']);
29
+ const releasedAt = textOf(box['releasedAt']);
30
+ return {
31
+ home,
32
+ package: pkg,
33
+ installedAt,
34
+ ...(name === undefined ? {} : { name }),
35
+ ...(registry === undefined ? {} : { registry }),
36
+ ...(releasedAt === undefined ? {} : { releasedAt }),
37
+ ...(box['local'] === true ? { local: true } : {}),
38
+ };
39
+ }
40
+ export function parsePluginLedger(raw) {
41
+ if (typeof raw !== 'object' || raw === null)
42
+ return [];
43
+ const list = raw['entries'];
44
+ if (!Array.isArray(list))
45
+ return [];
46
+ const entries = [];
47
+ for (const item of list) {
48
+ const entry = entryOf(item);
49
+ if (entry === undefined)
50
+ continue;
51
+ if (entries.some((known) => ledgerKeyOf(known) === ledgerKeyOf(entry)))
52
+ continue;
53
+ entries.push(entry);
54
+ }
55
+ return entries;
56
+ }
57
+ export function readPluginLedger(store) {
58
+ return parsePluginLedger(store.read(PLUGIN_LEDGER_FILE));
59
+ }
60
+ export function writePluginLedger(store, entries) {
61
+ if (entries.length === 0) {
62
+ store.remove(PLUGIN_LEDGER_FILE);
63
+ return;
64
+ }
65
+ store.write(PLUGIN_LEDGER_FILE, { entries });
66
+ }
67
+ export function pluginEntriesOfHome(entries, home) {
68
+ return entries.filter((entry) => entry.home === home);
69
+ }
70
+ export function isHeldEntry(entry) {
71
+ return entry.releasedAt === undefined;
72
+ }
73
+ export function heldEntriesOfHome(entries, home) {
74
+ return pluginEntriesOfHome(entries, home).filter(isHeldEntry);
75
+ }
76
+ export function heldEntryOfPlugin(entries, home, plugin) {
77
+ const key = plugin.trim();
78
+ if (key === '')
79
+ return undefined;
80
+ return heldEntriesOfHome(entries, home).find((entry) => entry.name === key || entry.package === key);
81
+ }
82
+ export function withReleasedEntry(entries, home, pkg, releasedAt) {
83
+ const entry = pluginEntryOf(entries, home, pkg);
84
+ if (entry === undefined || entry.releasedAt !== undefined)
85
+ return [...entries];
86
+ return withPluginEntry(entries, { ...entry, releasedAt });
87
+ }
88
+ export function pluginRetentionOf(options) {
89
+ if (options.held)
90
+ return 'keep-held';
91
+ if (!options.trustworthy)
92
+ return 'keep-unsure';
93
+ return options.claimedBy.length > 0 ? 'keep-claimed' : 'remove';
94
+ }
95
+ export function pluginEntryOf(entries, home, pkg) {
96
+ const key = ledgerKeyOf({ home, package: pkg });
97
+ return entries.find((entry) => ledgerKeyOf(entry) === key);
98
+ }
99
+ export function withPluginEntry(entries, entry) {
100
+ const key = ledgerKeyOf(entry);
101
+ return [...entries.filter((item) => ledgerKeyOf(item) !== key), entry];
102
+ }
103
+ export function withoutPluginEntry(entries, home, pkg) {
104
+ const key = ledgerKeyOf({ home, package: pkg });
105
+ return entries.filter((entry) => ledgerKeyOf(entry) !== key);
106
+ }
@@ -0,0 +1,3 @@
1
+ export declare function pluginAt(dir: string, manifestFile: string): {
2
+ readonly name?: string;
3
+ } | undefined;
@@ -0,0 +1,38 @@
1
+ import { readFileSync, readdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ function asRecord(value) {
4
+ return typeof value === 'object' && value !== null ? value : undefined;
5
+ }
6
+ function isCommandFile(name) {
7
+ if (name.endsWith('.d.ts') || name.endsWith('.test.ts'))
8
+ return false;
9
+ if (name.endsWith('.d.js'))
10
+ return false;
11
+ return name.endsWith('.ts') || name.endsWith('.js');
12
+ }
13
+ function pluginManifestOf(dir, manifestFile) {
14
+ try {
15
+ const parsed = JSON.parse(readFileSync(join(dir, manifestFile), 'utf8'));
16
+ if (Array.isArray(parsed))
17
+ return undefined;
18
+ return asRecord(parsed);
19
+ }
20
+ catch {
21
+ return undefined;
22
+ }
23
+ }
24
+ function hasCommandFile(dir) {
25
+ try {
26
+ return readdirSync(dir).some(isCommandFile);
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ export function pluginAt(dir, manifestFile) {
33
+ const manifest = pluginManifestOf(dir, manifestFile);
34
+ if (manifest === undefined || !hasCommandFile(dir))
35
+ return undefined;
36
+ const name = manifest.name;
37
+ return typeof name === 'string' && name.trim() !== '' ? { name: name.trim() } : {};
38
+ }
@@ -0,0 +1,233 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import type { Seam } from './seam/run.js';
3
+ import type { RuntimeCapabilities, RuntimeProfile } from '../contract/capabilities.js';
4
+ import type { PluginPackageKind } from '../contract/protocol/bundle-install.js';
5
+ import type { LibNeed, SupplySource } from '../contract/needs.js';
6
+ import type { NeedProbeInput, UnitCapability } from '../contract/unit-capability.js';
7
+ import type { DataReader } from '../contract/data.js';
8
+ import type { LibRunner } from '../contract/runner.js';
9
+ import type { WorkbenchSelfUpdate } from '../contract/protocol/bundle-install.js';
10
+ import type { BundleManager, InstalledModule, ProfileModule, ProfilePackage, RegistryNotebook, RuntimeStatus, SelfUpdateRequest, SelfUpdateStart } from './adapter-types.js';
11
+ import type { PostResource, RouteHandler, RouteTable } from './http.js';
12
+ import type { PluginSourceOptions, ResolvedPluginSource } from '../contract/plugin-source.js';
13
+ export interface LoggerLike {
14
+ info?(message: string): void;
15
+ warn?(message: string): void;
16
+ }
17
+ export interface ProfilePort {
18
+ dirOf(ctx: DshHostContext): string | null;
19
+ dshPlugins(ctx: DshHostContext): RouteHandler;
20
+ selfUpdateView(profile: string): WorkbenchSelfUpdate | undefined;
21
+ }
22
+ export type SupplyPluginSource = ResolvedPluginSource;
23
+ export interface SupplyPackageRoute {
24
+ readonly kind: PluginPackageKind | 'dsh-bundle' | 'neither';
25
+ readonly pkg?: string;
26
+ readonly pluginName?: string;
27
+ }
28
+ export interface SupplyRelease {
29
+ readonly installed?: string;
30
+ readonly latest?: string;
31
+ readonly missing?: readonly string[];
32
+ }
33
+ export interface SupplyNpmRef {
34
+ readonly name: string;
35
+ readonly version?: string;
36
+ }
37
+ export interface SupplyPluginInstallOptions {
38
+ readonly spec: string;
39
+ readonly command: string;
40
+ readonly registry?: string | undefined;
41
+ readonly pluginName?: string | undefined;
42
+ }
43
+ export interface SupplyLatestOptions {
44
+ readonly seam: Seam;
45
+ readonly name: string;
46
+ readonly registry: string;
47
+ readonly force?: boolean;
48
+ readonly includePrerelease?: boolean;
49
+ }
50
+ export interface SupplyMissingPartsOptions {
51
+ readonly seam: Seam;
52
+ readonly name: string;
53
+ readonly registry: string;
54
+ readonly version: string;
55
+ readonly force?: boolean;
56
+ }
57
+ export interface SupplyProbeReleaseOptions {
58
+ readonly seam: Seam;
59
+ readonly package: string;
60
+ readonly registry?: string | undefined;
61
+ readonly force?: boolean;
62
+ readonly check?: boolean;
63
+ readonly includePrerelease?: boolean;
64
+ }
65
+ export interface EnvSupplyPort {
66
+ resolvePluginSource(source: SupplySource | undefined, env: Readonly<Record<string, string | undefined>>, options?: PluginSourceOptions): ResolvedPluginSource;
67
+ libInstallCommand(options: {
68
+ readonly need: LibNeed;
69
+ readonly source: Extract<SupplySource, {
70
+ kind: 'npm';
71
+ }>;
72
+ readonly version?: string | undefined;
73
+ }): string;
74
+ libUninstallCommand(options: {
75
+ readonly need: LibNeed;
76
+ }): string;
77
+ pluginInstallPlan(options: SupplyPluginInstallOptions): ResolvedPluginSource;
78
+ recoveryCommand(options: {
79
+ readonly profile: string;
80
+ readonly version: string;
81
+ }): string;
82
+ latestVersion(options: SupplyLatestOptions): Promise<string | undefined>;
83
+ missingReleaseParts(options: SupplyMissingPartsOptions): Promise<readonly string[]>;
84
+ probeRelease(options: SupplyProbeReleaseOptions): Promise<SupplyRelease | undefined>;
85
+ splitNpmSpec(spec: string): SupplyNpmRef | undefined;
86
+ }
87
+ export interface ModulePort {
88
+ isolatedRoot(): string;
89
+ isolatedHome(): string;
90
+ pluginPackagePrefix?(): string;
91
+ pluginManifestFile?(): string;
92
+ cliCatalogPath?(): string;
93
+ vendorPluginsDir?(): string;
94
+ runtimeInstallCommand?(): string;
95
+ afterLibInstall(): void;
96
+ profileDirOf(ctx: DshHostContext): string | null;
97
+ profileModules(dir: string | null): readonly ProfileModule[];
98
+ readInstalledModule(dir: string | null, pkg: string): InstalledModule;
99
+ readProfilePackage(dir: string | null, pkg: string): ProfilePackage | undefined;
100
+ readBundleManager(ctx: DshHostContext): BundleManager | undefined;
101
+ createRegistryNotebook(dir: string | null): RegistryNotebook;
102
+ declarationGaps(dir: string | null): readonly {
103
+ readonly pkg: string;
104
+ }[] | undefined;
105
+ moduleDeclarationOf(dir: string | null, pkg: string): unknown;
106
+ registryDeclarationOf(options: {
107
+ readonly seam: Seam;
108
+ readonly name: string;
109
+ readonly registry: string;
110
+ readonly force?: boolean;
111
+ }): Promise<unknown>;
112
+ pathDeclarationOf(spec: string): unknown;
113
+ declarationRefusalOf(name: string, raw: unknown): readonly string[];
114
+ refusalReason(): string;
115
+ packageRouteOf(options: {
116
+ readonly spec: string;
117
+ readonly seam?: Seam | undefined;
118
+ readonly registry?: string | undefined;
119
+ readonly force?: boolean;
120
+ }): Promise<SupplyPackageRoute | undefined>;
121
+ isNewerVersion(left: string, right: string): boolean;
122
+ startSelfUpdate(request: SelfUpdateRequest, onError: (message: string) => void): SelfUpdateStart;
123
+ }
124
+ export interface SupplyPort extends EnvSupplyPort, ModulePort {
125
+ readonly env: EnvSupplyPort;
126
+ readonly modules: ModulePort;
127
+ }
128
+ export interface ProbeUnitsOptions {
129
+ readonly seam: Seam;
130
+ readonly runtimeCommands: Readonly<Record<string, string>>;
131
+ readonly units: readonly NeedProbeInput[];
132
+ readonly force?: boolean;
133
+ }
134
+ export interface ProbePreflightInput {
135
+ readonly routes: RouteTable;
136
+ readonly ctx: DshHostContext;
137
+ readonly seam: Seam;
138
+ readonly runtimeCommands: Readonly<Record<string, string>>;
139
+ readonly runtimeCapabilities: RuntimeCapabilities;
140
+ readonly runtimeCheck?: (() => Promise<RuntimeCheck>) | undefined;
141
+ readonly runtimeLabel?: string | undefined;
142
+ readonly warmReads: () => readonly (readonly string[])[];
143
+ readonly extensionDir?: string | undefined;
144
+ }
145
+ export interface ProbePort {
146
+ probeUnits(options: ProbeUnitsOptions): Promise<UnitCapability[]>;
147
+ registerPreflight(input: ProbePreflightInput): void;
148
+ declaredPluginCommands(profileDir: string | null): ReadonlyMap<string, ReadonlySet<string>>;
149
+ }
150
+ export interface RuntimeSeedOptions {
151
+ readonly corePackageUrl: string;
152
+ readonly log: (message: string) => void;
153
+ }
154
+ export type { RuntimeCapabilities, RuntimeProfile, RuntimeTerms } from '../contract/capabilities.js';
155
+ export interface RuntimeCheck {
156
+ readonly ok: boolean;
157
+ readonly detail: string;
158
+ }
159
+ export interface RuntimeCommandSurface {
160
+ readonly name: string;
161
+ readonly pluginPrefix: string;
162
+ invoke(site: string, command?: string): string;
163
+ help(site: string): string;
164
+ browser?(verb: readonly string[]): string;
165
+ background?(command: string, argv: readonly string[]): string;
166
+ readonly authorHint?: string;
167
+ }
168
+ export interface RuntimePort {
169
+ packageRoot(moduleUrl: string): string;
170
+ capabilities(ctx: DshHostContext): RuntimeCapabilities;
171
+ profile?(ctx: DshHostContext): RuntimeProfile;
172
+ commandSurface?(ctx: DshHostContext): RuntimeCommandSurface | undefined;
173
+ check?(ctx: DshHostContext): Promise<RuntimeCheck>;
174
+ commands(ctx: DshHostContext): Readonly<Record<string, string>>;
175
+ runners(ctx: DshHostContext, data: DataReader): Readonly<Record<string, LibRunner>>;
176
+ health(ctx: DshHostContext): Readonly<Record<string, RuntimeStatus>>;
177
+ seed(ctx: DshHostContext, options: RuntimeSeedOptions): void;
178
+ }
179
+ export interface PluginDeclarationSource {
180
+ readonly pkg: string;
181
+ readonly declaration: unknown;
182
+ }
183
+ export interface PluginRowRef {
184
+ readonly id: string;
185
+ readonly pkg: string;
186
+ readonly name?: string | undefined;
187
+ }
188
+ export interface PluginRowsSource {
189
+ listPlugins(workspace: string | null): readonly PluginRowRef[];
190
+ subscribe?(listener: () => void): () => void;
191
+ }
192
+ export interface PluginUnitsPort {
193
+ refresh(options?: {
194
+ readonly force?: boolean;
195
+ }): Promise<unknown>;
196
+ touch(): void;
197
+ report(): unknown;
198
+ dispose(): void;
199
+ }
200
+ export interface PluginUnitsInput {
201
+ readonly registry: {
202
+ registerPlugin(face: unknown): () => void;
203
+ };
204
+ readonly rows: () => readonly PluginRowRef[];
205
+ readonly declared: (plugin: string) => ReadonlySet<string>;
206
+ readonly toolNames?: () => ReadonlySet<string>;
207
+ readonly logger?: LoggerLike | undefined;
208
+ }
209
+ export interface PluginSurface {
210
+ declarationLookup(profileDir: string | null): (unit: string) => PluginDeclarationSource | undefined;
211
+ createUnits(input: PluginUnitsInput): PluginUnitsPort;
212
+ }
213
+ export interface ConfigSyncInput {
214
+ readonly home: string;
215
+ readonly self: string;
216
+ readonly profileDir: string | null;
217
+ readonly reconcile?: (() => Promise<boolean | void>) | undefined;
218
+ }
219
+ export interface ProfileCreateInput {
220
+ readonly home: string;
221
+ readonly self: string;
222
+ readonly packageRoot: string;
223
+ readonly runSetup?: ((env: Readonly<Record<string, string>>) => Promise<{
224
+ ok: boolean;
225
+ log: string;
226
+ }>) | undefined;
227
+ }
228
+ export interface HostActions {
229
+ configSyncHandler(input: ConfigSyncInput): RouteHandler;
230
+ profileCreateHandler(input: ProfileCreateInput): RouteHandler;
231
+ configSyncAction(input: ConfigSyncInput): PostResource;
232
+ profileCreateAction(input: ProfileCreateInput): PostResource;
233
+ }
@@ -0,0 +1 @@
1
+ export {};