@dsh-workbench/shared 1.5.2-alpha.4 → 1.5.2-alpha.5

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 (310) 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/protocol/unit-manager.d.ts +50 -0
  99. package/dist/contract/protocol/unit-manager.js +2 -0
  100. package/dist/host/adapter-contract.d.ts +3 -0
  101. package/dist/host/adapter-contract.js +95 -0
  102. package/dist/host/adapter-set.d.ts +27 -0
  103. package/dist/host/adapter-set.js +258 -0
  104. package/dist/host/adapter-types.d.ts +87 -0
  105. package/dist/host/adapter-types.js +23 -0
  106. package/dist/host/adapters/platform.d.ts +14 -0
  107. package/dist/host/adapters/platform.js +40 -0
  108. package/dist/host/adapters.d.ts +28 -0
  109. package/dist/host/adapters.js +9 -0
  110. package/dist/host/auth-loss.d.ts +33 -0
  111. package/dist/host/auth-loss.js +107 -0
  112. package/dist/host/board-fact.d.ts +8 -0
  113. package/dist/host/board-fact.js +16 -0
  114. package/dist/host/boot-record.d.ts +11 -0
  115. package/dist/host/boot-record.js +31 -0
  116. package/dist/host/browser.d.ts +3 -0
  117. package/dist/host/browser.js +3 -0
  118. package/dist/host/bundle-manager.d.ts +4 -0
  119. package/dist/host/bundle-manager.js +338 -0
  120. package/dist/host/changelog.d.ts +28 -0
  121. package/dist/host/changelog.js +201 -0
  122. package/dist/host/cli-error.d.ts +8 -0
  123. package/dist/host/cli-error.js +70 -0
  124. package/dist/host/cli.d.ts +4 -0
  125. package/dist/host/cli.js +9 -0
  126. package/dist/host/config-sync.d.ts +40 -0
  127. package/dist/host/config-sync.js +267 -0
  128. package/dist/host/context-ref.d.ts +13 -0
  129. package/dist/host/context-ref.js +41 -0
  130. package/dist/host/data-error.d.ts +15 -0
  131. package/dist/host/data-error.js +23 -0
  132. package/dist/host/data-plan-check.d.ts +10 -0
  133. package/dist/host/data-plan-check.js +315 -0
  134. package/dist/host/data-plan.d.ts +15 -0
  135. package/dist/host/data-plan.js +283 -0
  136. package/dist/host/data-root.d.ts +5 -0
  137. package/dist/host/data-root.js +23 -0
  138. package/dist/host/diy-debug.d.ts +80 -0
  139. package/dist/host/diy-debug.js +89 -0
  140. package/dist/host/diy-preset.d.ts +26 -0
  141. package/dist/host/diy-preset.js +115 -0
  142. package/dist/host/diy-record.d.ts +135 -0
  143. package/dist/host/diy-record.js +163 -0
  144. package/dist/host/dsh-compat.d.ts +27 -0
  145. package/dist/host/dsh-compat.js +75 -0
  146. package/dist/host/dsh-plugins.d.ts +5 -0
  147. package/dist/host/dsh-plugins.js +51 -0
  148. package/dist/host/env-policy.d.ts +82 -0
  149. package/dist/host/env-policy.js +181 -0
  150. package/dist/host/extension.d.ts +7 -0
  151. package/dist/host/extension.js +40 -0
  152. package/dist/host/facts.d.ts +31 -0
  153. package/dist/host/facts.js +58 -0
  154. package/dist/host/fs-write.d.ts +96 -0
  155. package/dist/host/fs-write.js +183 -0
  156. package/dist/host/git.d.ts +5 -0
  157. package/dist/host/git.js +1 -0
  158. package/dist/host/host-actions.d.ts +2 -0
  159. package/dist/host/host-actions.js +5 -0
  160. package/dist/host/host-kit.d.ts +37 -0
  161. package/dist/host/host-kit.js +27 -0
  162. package/dist/host/http.d.ts +47 -0
  163. package/dist/host/http.js +289 -0
  164. package/dist/host/install-failure.d.ts +50 -0
  165. package/dist/host/install-failure.js +184 -0
  166. package/dist/host/installed-module.d.ts +25 -0
  167. package/dist/host/installed-module.js +289 -0
  168. package/dist/host/installed-sources.d.ts +10 -0
  169. package/dist/host/installed-sources.js +63 -0
  170. package/dist/host/lease.d.ts +70 -0
  171. package/dist/host/lease.js +264 -0
  172. package/dist/host/lib-capabilities.d.ts +22 -0
  173. package/dist/host/lib-capabilities.js +37 -0
  174. package/dist/host/lib-install.d.ts +19 -0
  175. package/dist/host/lib-install.js +40 -0
  176. package/dist/host/lib-runners.d.ts +18 -0
  177. package/dist/host/lib-runners.js +46 -0
  178. package/dist/host/local-declaration.d.ts +7 -0
  179. package/dist/host/local-declaration.js +33 -0
  180. package/dist/host/long-task.d.ts +97 -0
  181. package/dist/host/long-task.js +297 -0
  182. package/dist/host/market-index-claim.d.ts +19 -0
  183. package/dist/host/market-index-claim.js +87 -0
  184. package/dist/host/market-index-doc.d.ts +12 -0
  185. package/dist/host/market-index-doc.js +1 -0
  186. package/dist/host/market-index-parse.d.ts +28 -0
  187. package/dist/host/market-index-parse.js +413 -0
  188. package/dist/host/market-index.d.ts +13 -0
  189. package/dist/host/market-index.js +105 -0
  190. package/dist/host/module-root.d.ts +1 -0
  191. package/dist/host/module-root.js +5 -0
  192. package/dist/host/needs.d.ts +4 -0
  193. package/dist/host/needs.js +2 -0
  194. package/dist/host/npm-registry.d.ts +10 -0
  195. package/dist/host/npm-registry.js +16 -0
  196. package/dist/host/package-content.d.ts +8 -0
  197. package/dist/host/package-content.js +90 -0
  198. package/dist/host/package-kind.d.ts +13 -0
  199. package/dist/host/package-kind.js +51 -0
  200. package/dist/host/package-route.d.ts +33 -0
  201. package/dist/host/package-route.js +68 -0
  202. package/dist/host/panel-state.d.ts +120 -0
  203. package/dist/host/panel-state.js +177 -0
  204. package/dist/host/patch-blocks.d.ts +13 -0
  205. package/dist/host/patch-blocks.js +52 -0
  206. package/dist/host/patch.d.ts +4 -0
  207. package/dist/host/patch.js +7 -0
  208. package/dist/host/paths.d.ts +12 -0
  209. package/dist/host/paths.js +20 -0
  210. package/dist/host/payload.d.ts +12 -0
  211. package/dist/host/payload.js +16 -0
  212. package/dist/host/plan-results.d.ts +5 -0
  213. package/dist/host/plan-results.js +71 -0
  214. package/dist/host/plan-run.d.ts +41 -0
  215. package/dist/host/plan-run.js +87 -0
  216. package/dist/host/platform.d.ts +14 -0
  217. package/dist/host/platform.js +40 -0
  218. package/dist/host/plugin-ledger.d.ts +32 -0
  219. package/dist/host/plugin-ledger.js +106 -0
  220. package/dist/host/plugin.d.ts +3 -0
  221. package/dist/host/plugin.js +38 -0
  222. package/dist/host/port-types.d.ts +233 -0
  223. package/dist/host/port-types.js +1 -0
  224. package/dist/host/preflight.d.ts +32 -0
  225. package/dist/host/preflight.js +1 -0
  226. package/dist/host/process-alive.d.ts +6 -0
  227. package/dist/host/process-alive.js +16 -0
  228. package/dist/host/profile-bundles.d.ts +20 -0
  229. package/dist/host/profile-bundles.js +48 -0
  230. package/dist/host/profile-create.d.ts +19 -0
  231. package/dist/host/profile-create.js +124 -0
  232. package/dist/host/profile-port.d.ts +4 -0
  233. package/dist/host/profile-port.js +4 -0
  234. package/dist/host/profile-registries.d.ts +10 -0
  235. package/dist/host/profile-registries.js +149 -0
  236. package/dist/host/provision.d.ts +32 -0
  237. package/dist/host/provision.js +105 -0
  238. package/dist/host/read-json.d.ts +1 -0
  239. package/dist/host/read-json.js +11 -0
  240. package/dist/host/recipe-rules.d.ts +5 -0
  241. package/dist/host/recipe-rules.js +412 -0
  242. package/dist/host/recipe.d.ts +14 -0
  243. package/dist/host/recipe.js +332 -0
  244. package/dist/host/registry-declaration.d.ts +21 -0
  245. package/dist/host/registry-declaration.js +42 -0
  246. package/dist/host/reinstall-record.d.ts +16 -0
  247. package/dist/host/reinstall-record.js +54 -0
  248. package/dist/host/release-age.d.ts +24 -0
  249. package/dist/host/release-age.js +92 -0
  250. package/dist/host/release-packages.generated.d.ts +1 -0
  251. package/dist/host/release-packages.generated.js +10 -0
  252. package/dist/host/release-probe.d.ts +37 -0
  253. package/dist/host/release-probe.js +156 -0
  254. package/dist/host/runtime/browser-argv.d.ts +1 -0
  255. package/dist/host/runtime/browser-argv.js +9 -0
  256. package/dist/host/runtime/front-app.d.ts +6 -0
  257. package/dist/host/runtime/front-app.js +70 -0
  258. package/dist/host/shell-render.d.ts +52 -0
  259. package/dist/host/shell-render.js +117 -0
  260. package/dist/host/shell-text.d.ts +30 -0
  261. package/dist/host/shell-text.js +40 -0
  262. package/dist/host/shell.d.ts +25 -0
  263. package/dist/host/shell.js +55 -0
  264. package/dist/host/site.d.ts +45 -0
  265. package/dist/host/site.js +182 -0
  266. package/dist/host/spec.d.ts +8 -0
  267. package/dist/host/spec.js +24 -0
  268. package/dist/host/submit-confirm.d.ts +19 -0
  269. package/dist/host/submit-confirm.js +45 -0
  270. package/dist/host/supply-index.d.ts +38 -0
  271. package/dist/host/supply-index.js +209 -0
  272. package/dist/host/supply-port.d.ts +5 -0
  273. package/dist/host/supply-port.js +50 -0
  274. package/dist/host/time.d.ts +22 -0
  275. package/dist/host/time.js +33 -0
  276. package/dist/host/tokens.d.ts +26 -0
  277. package/dist/host/tokens.js +154 -0
  278. package/dist/host/tool-approval.d.ts +86 -0
  279. package/dist/host/tool-approval.js +118 -0
  280. package/dist/host/tool-kit.d.ts +8 -0
  281. package/dist/host/tool-kit.js +22 -0
  282. package/dist/host/toolbox-port.d.ts +16 -0
  283. package/dist/host/toolbox-port.js +1 -0
  284. package/dist/host/unit-config.d.ts +34 -0
  285. package/dist/host/unit-config.js +28 -0
  286. package/dist/host/unit-data.d.ts +3 -0
  287. package/dist/host/unit-data.js +127 -0
  288. package/dist/host/unit-face.d.ts +95 -0
  289. package/dist/host/unit-face.js +1 -0
  290. package/dist/host/unit-plugin.d.ts +24 -0
  291. package/dist/host/unit-plugin.js +25 -0
  292. package/dist/host/update-journal-manifest.d.ts +19 -0
  293. package/dist/host/update-journal-manifest.js +134 -0
  294. package/dist/host/update-journal-types.d.ts +33 -0
  295. package/dist/host/update-journal-types.js +2 -0
  296. package/dist/host/update-journal.d.ts +43 -0
  297. package/dist/host/update-journal.js +409 -0
  298. package/dist/host/value-handoff.d.ts +16 -0
  299. package/dist/host/value-handoff.js +22 -0
  300. package/dist/host/version-range.d.ts +2 -0
  301. package/dist/host/version-range.js +13 -0
  302. package/dist/host/version.d.ts +4 -0
  303. package/dist/host/version.js +32 -0
  304. package/dist/host/workspace-store.d.ts +19 -0
  305. package/dist/host/workspace-store.js +133 -0
  306. package/dist/host/write-result.d.ts +1 -0
  307. package/dist/host/write-result.js +18 -0
  308. package/dist/lib/dsh-client.d.ts +1 -1
  309. package/package.json +51 -47
  310. package/src/lib/dsh-client.ts +2 -1
@@ -0,0 +1,50 @@
1
+ import type { UnitTitle } from '../unit.js';
2
+ export declare const UNIT_MANAGER_ROUTE = "unit-manager";
3
+ export declare const UNIT_MODULE_ROUTE = "unit-module";
4
+ export interface UnitEntry {
5
+ readonly id: string;
6
+ readonly pkg: string;
7
+ readonly version?: string | undefined;
8
+ readonly enabled: boolean;
9
+ readonly local?: boolean | undefined;
10
+ readonly title?: UnitTitle | undefined;
11
+ }
12
+ export type UnitStage = 'install' | 'enable' | 'remove';
13
+ export type UnitApplication = 'applied' | 'restart-required' | 'failed' | 'cancelled';
14
+ export type UnitRestartReason = 'module-comparison' | 'no-hmr' | 'package-moved';
15
+ export interface UnitError {
16
+ readonly code: string;
17
+ readonly message: string;
18
+ readonly detail?: string | undefined;
19
+ }
20
+ export interface UnitChangeResult {
21
+ readonly changed: boolean;
22
+ readonly application: UnitApplication;
23
+ readonly restartReason?: UnitRestartReason | undefined;
24
+ readonly stage: UnitStage;
25
+ readonly target: string;
26
+ readonly enabled?: boolean | undefined;
27
+ readonly error?: UnitError | undefined;
28
+ readonly version?: string | undefined;
29
+ readonly warnings?: readonly string[] | undefined;
30
+ }
31
+ export interface UnitListPayload {
32
+ readonly ok: true;
33
+ readonly units: readonly UnitEntry[];
34
+ }
35
+ export interface UnitChangePayload {
36
+ readonly ok: boolean;
37
+ readonly result?: UnitChangeResult | undefined;
38
+ readonly error?: UnitError | undefined;
39
+ }
40
+ export interface UnitModuleDescriptor {
41
+ readonly unit: string;
42
+ readonly pkg: string;
43
+ readonly url: string;
44
+ readonly hash: string;
45
+ }
46
+ export interface UnitModulePayload {
47
+ readonly ok: boolean;
48
+ readonly module?: UnitModuleDescriptor | undefined;
49
+ readonly error?: UnitError | undefined;
50
+ }
@@ -0,0 +1,2 @@
1
+ export const UNIT_MANAGER_ROUTE = 'unit-manager';
2
+ export const UNIT_MODULE_ROUTE = 'unit-module';
@@ -0,0 +1,3 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import type { AdapterSet } from './adapters.js';
3
+ export declare function adapterContractGaps(set: AdapterSet, ctx: DshHostContext): readonly string[];
@@ -0,0 +1,95 @@
1
+ import { validateAdapterSet } from './adapter-set.js';
2
+ const CAPABILITY_KEYS = ['console', 'pluginMarket', 'browserBridge'];
3
+ const CAPABILITIES_COVERED = true;
4
+ void CAPABILITIES_COVERED;
5
+ const DATA_METHODS = ['read', 'request', 'requestMany', 'submit', 'plan'];
6
+ function isNonEmptyString(value) {
7
+ return typeof value === 'string' && value.trim() !== '';
8
+ }
9
+ const CLI_DIR_METHODS = [
10
+ ['cliCatalogPath', 'cliCatalogPath'],
11
+ ['vendorPluginsDir', 'vendorPluginsDir'],
12
+ ];
13
+ export function adapterContractGaps(set, ctx) {
14
+ const gaps = [];
15
+ const validated = validateAdapterSet(set, '契约');
16
+ if (!validated.ok) {
17
+ gaps.push(`成员不全:${validated.detail}`);
18
+ return gaps;
19
+ }
20
+ if (!Number.isInteger(set.apiVersion) || set.apiVersion < 1) {
21
+ gaps.push(`apiVersion 不是正整数:${String(set.apiVersion)}`);
22
+ }
23
+ const capabilities = set.runtime.capabilities(ctx);
24
+ for (const key of CAPABILITY_KEYS) {
25
+ if (typeof capabilities[key] !== 'boolean')
26
+ gaps.push(`capabilities.${key} 不是布尔值`);
27
+ }
28
+ if (typeof set.runtime.profile === 'function') {
29
+ const profile = set.runtime.profile(ctx);
30
+ if (!isNonEmptyString(profile?.label))
31
+ gaps.push('runtime.profile().label 不是非空字符串');
32
+ for (const key of ['plugin', 'pluginOf', 'pluginThing', 'pluginArea']) {
33
+ const text = profile?.terms?.[key];
34
+ if (!isNonEmptyString(text?.zh) || !isNonEmptyString(text?.en)) {
35
+ gaps.push(`runtime.profile().terms.${key} 要给 zh / en 两份非空文案`);
36
+ }
37
+ }
38
+ if (!isNonEmptyString(profile?.installHint?.zh) || !isNonEmptyString(profile?.installHint?.en)) {
39
+ gaps.push('runtime.profile().installHint 要给 zh / en 两份非空文案');
40
+ }
41
+ }
42
+ if (typeof set.runtime.commandSurface === 'function') {
43
+ const surface = set.runtime.commandSurface(ctx);
44
+ if (surface !== undefined) {
45
+ if (!isNonEmptyString(surface.name))
46
+ gaps.push('runtime.commandSurface().name 不是非空字符串');
47
+ if (!isNonEmptyString(surface.pluginPrefix)) {
48
+ gaps.push('runtime.commandSurface().pluginPrefix 不是非空字符串');
49
+ }
50
+ if (typeof surface.invoke !== 'function')
51
+ gaps.push('runtime.commandSurface().invoke 不是函数');
52
+ else if (!isNonEmptyString(surface.invoke('site', 'command'))) {
53
+ gaps.push('runtime.commandSurface().invoke(site, command) 拼不出非空命令行');
54
+ }
55
+ if (typeof surface.help !== 'function')
56
+ gaps.push('runtime.commandSurface().help 不是函数');
57
+ else if (!isNonEmptyString(surface.help('site'))) {
58
+ gaps.push('runtime.commandSurface().help(site) 拼不出非空提示');
59
+ }
60
+ }
61
+ }
62
+ const health = set.runtime.health(ctx);
63
+ const commands = set.runtime.commands(ctx);
64
+ for (const [name, status] of Object.entries(health)) {
65
+ if (!isNonEmptyString(status?.command))
66
+ gaps.push(`health['${name}'].command 不是非空字符串`);
67
+ if (!['env', 'isolated', 'path'].includes(status?.source))
68
+ gaps.push(`health['${name}'].source 不是已知来源`);
69
+ }
70
+ for (const name of Object.keys(commands)) {
71
+ if (health[name] === undefined)
72
+ gaps.push(`commands 里的 ${name} 在 health 里没有对应条目`);
73
+ else if (!isNonEmptyString(commands[name]))
74
+ gaps.push(`commands['${name}'] 不是非空字符串`);
75
+ }
76
+ for (const method of DATA_METHODS) {
77
+ if (typeof set.data[method] !== 'function')
78
+ gaps.push(`data.${method} 不是函数`);
79
+ }
80
+ if (!isNonEmptyString(set.modules.isolatedRoot()))
81
+ gaps.push('modules.isolatedRoot() 不是非空字符串');
82
+ if (set.modules.runtimeInstallCommand !== undefined && !isNonEmptyString(set.modules.runtimeInstallCommand())) {
83
+ gaps.push('modules.runtimeInstallCommand() 给了但不是非空字符串');
84
+ }
85
+ for (const [name, method] of CLI_DIR_METHODS) {
86
+ const given = set.modules[method];
87
+ if (given !== undefined && !isNonEmptyString(given()))
88
+ gaps.push(`modules.${method}() 给了但不是非空字符串(${name})`);
89
+ }
90
+ if (typeof set.probe.probeUnits !== 'function')
91
+ gaps.push('probe.probeUnits 不是函数');
92
+ if (typeof set.probe.registerPreflight !== 'function')
93
+ gaps.push('probe.registerPreflight 不是函数');
94
+ return gaps;
95
+ }
@@ -0,0 +1,27 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import { type AdapterSet, type CoreAdapterSet } from './adapters.js';
3
+ export interface WorkbenchConfig {
4
+ readonly adapterSet?: string;
5
+ }
6
+ export type AdapterSetFailure = 'not-configured' | 'no-profile' | 'malformed' | 'not-resolvable' | 'import-failed' | 'bad-export' | 'factory-failed' | 'incompatible-version' | 'missing-member';
7
+ export type AdapterSetLoad = {
8
+ readonly ok: true;
9
+ readonly spec: string;
10
+ readonly set: CoreAdapterSet;
11
+ } | {
12
+ readonly ok: false;
13
+ readonly spec?: string;
14
+ readonly failure: AdapterSetFailure;
15
+ readonly detail: string;
16
+ readonly cause?: unknown;
17
+ };
18
+ export declare const CORE_METHODS: readonly [readonly ["data", "read"], readonly ["data", "request"], readonly ["data", "requestMany"], readonly ["data", "submit"], readonly ["data", "plan"], readonly ["data", "submitPlan"], readonly ["supply", "resolvePluginSource"], readonly ["supply", "libInstallCommand"], readonly ["supply", "libUninstallCommand"], readonly ["supply", "pluginInstallPlan"], readonly ["supply", "recoveryCommand"], readonly ["supply", "latestVersion"], readonly ["supply", "missingReleaseParts"], readonly ["supply", "probeRelease"], readonly ["supply", "splitNpmSpec"], readonly ["profile", "dirOf"], readonly ["profile", "dshPlugins"], readonly ["profile", "selfUpdateView"], readonly ["probe", "probeUnits"], readonly ["probe", "registerPreflight"], readonly ["probe", "declaredPluginCommands"]];
19
+ export declare function validateAdapterSet(value: unknown, spec: string): AdapterSetLoad;
20
+ export declare function loadAdapterSet(ctx: DshHostContext, spec: string | undefined): Promise<AdapterSetLoad>;
21
+ export declare function withDefaultAdapterSet(defaults: AdapterSet, loaded: AdapterSetLoad): AdapterSet;
22
+ export declare function resolveAdapterSet(ctx: DshHostContext, spec: string | undefined, makeDefaults: () => Promise<AdapterSet>): Promise<{
23
+ readonly set: AdapterSet;
24
+ readonly load: AdapterSetLoad;
25
+ readonly usedDefaults: boolean;
26
+ }>;
27
+ export type { AdapterSet, CoreAdapterSet };
@@ -0,0 +1,258 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+ import { ADAPTER_SET_API_VERSION, SUPPORTED_ADAPTER_API_VERSIONS, } from './adapters.js';
6
+ import { profileDirOf } from './installed-module.js';
7
+ import { isPackageName } from './spec.js';
8
+ const CORE_MEMBERS = ['data', 'supply', 'profile', 'probe'];
9
+ export const CORE_METHODS = [
10
+ ['data', 'read'],
11
+ ['data', 'request'],
12
+ ['data', 'requestMany'],
13
+ ['data', 'submit'],
14
+ ['data', 'plan'],
15
+ ['data', 'submitPlan'],
16
+ ['supply', 'resolvePluginSource'],
17
+ ['supply', 'libInstallCommand'],
18
+ ['supply', 'libUninstallCommand'],
19
+ ['supply', 'pluginInstallPlan'],
20
+ ['supply', 'recoveryCommand'],
21
+ ['supply', 'latestVersion'],
22
+ ['supply', 'missingReleaseParts'],
23
+ ['supply', 'probeRelease'],
24
+ ['supply', 'splitNpmSpec'],
25
+ ['profile', 'dirOf'],
26
+ ['profile', 'dshPlugins'],
27
+ ['profile', 'selfUpdateView'],
28
+ ['probe', 'probeUnits'],
29
+ ['probe', 'registerPreflight'],
30
+ ['probe', 'declaredPluginCommands'],
31
+ ];
32
+ const DATA_METHODS_COVERED = true;
33
+ const SUPPLY_METHODS_COVERED = true;
34
+ const PROFILE_METHODS_COVERED = true;
35
+ const PROBE_METHODS_COVERED = true;
36
+ void DATA_METHODS_COVERED;
37
+ void SUPPLY_METHODS_COVERED;
38
+ void PROFILE_METHODS_COVERED;
39
+ void PROBE_METHODS_COVERED;
40
+ const FULL_MEMBERS = ['modules', 'runtime', 'plugins', 'actions'];
41
+ const FULL_METHODS = [
42
+ ['modules', 'isolatedRoot'],
43
+ ['modules', 'isolatedHome'],
44
+ ['modules', 'afterLibInstall'],
45
+ ['modules', 'profileDirOf'],
46
+ ['modules', 'profileModules'],
47
+ ['modules', 'readInstalledModule'],
48
+ ['modules', 'readProfilePackage'],
49
+ ['modules', 'readBundleManager'],
50
+ ['modules', 'createRegistryNotebook'],
51
+ ['modules', 'declarationGaps'],
52
+ ['modules', 'moduleDeclarationOf'],
53
+ ['modules', 'registryDeclarationOf'],
54
+ ['modules', 'pathDeclarationOf'],
55
+ ['modules', 'declarationRefusalOf'],
56
+ ['modules', 'refusalReason'],
57
+ ['modules', 'packageRouteOf'],
58
+ ['modules', 'isNewerVersion'],
59
+ ['modules', 'startSelfUpdate'],
60
+ ['runtime', 'packageRoot'],
61
+ ['runtime', 'capabilities'],
62
+ ['runtime', 'commands'],
63
+ ['runtime', 'runners'],
64
+ ['runtime', 'health'],
65
+ ['runtime', 'seed'],
66
+ ['plugins', 'declarationLookup'],
67
+ ['plugins', 'createUnits'],
68
+ ['actions', 'configSyncHandler'],
69
+ ['actions', 'profileCreateHandler'],
70
+ ['actions', 'configSyncAction'],
71
+ ['actions', 'profileCreateAction'],
72
+ ];
73
+ function methodOf(value, member, method) {
74
+ const part = value[member];
75
+ if (typeof part !== 'object' || part === null)
76
+ return undefined;
77
+ return part[method];
78
+ }
79
+ function failure(failureKind, detail, spec, cause) {
80
+ return {
81
+ ok: false,
82
+ ...(spec === undefined ? {} : { spec }),
83
+ failure: failureKind,
84
+ detail,
85
+ ...(cause === undefined ? {} : { cause }),
86
+ };
87
+ }
88
+ function packageDirOf(spec, from) {
89
+ let dir = from;
90
+ for (;;) {
91
+ const candidate = join(dir, 'node_modules', spec);
92
+ if (existsSync(join(candidate, 'package.json')))
93
+ return candidate;
94
+ const up = dirname(dir);
95
+ if (up === dir)
96
+ return undefined;
97
+ dir = up;
98
+ }
99
+ }
100
+ function entryOf(value) {
101
+ if (typeof value === 'string')
102
+ return value;
103
+ if (typeof value !== 'object' || value === null)
104
+ return undefined;
105
+ const record = value;
106
+ for (const key of ['import', 'node', 'module', 'default', 'require']) {
107
+ const found = entryOf(record[key]);
108
+ if (found !== undefined)
109
+ return found;
110
+ }
111
+ return undefined;
112
+ }
113
+ function exportsEntryOf(value) {
114
+ if (typeof value !== 'object' || value === null)
115
+ return entryOf(value);
116
+ const record = value;
117
+ return '.' in record ? entryOf(record['.']) : entryOf(record);
118
+ }
119
+ function esmEntryUrl(spec, profileDir) {
120
+ const dir = packageDirOf(spec, profileDir);
121
+ if (dir === undefined)
122
+ return undefined;
123
+ let pkg;
124
+ try {
125
+ pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
126
+ }
127
+ catch {
128
+ return undefined;
129
+ }
130
+ const main = typeof pkg['main'] === 'string' ? pkg['main'] : undefined;
131
+ const module = typeof pkg['module'] === 'string' ? pkg['module'] : undefined;
132
+ const entry = exportsEntryOf(pkg['exports']) ?? module ?? main ?? 'index.js';
133
+ const file = join(dir, entry);
134
+ return existsSync(file) ? pathToFileURL(file).href : undefined;
135
+ }
136
+ function resolveFromProfile(spec, profileDir) {
137
+ const esm = esmEntryUrl(spec, profileDir);
138
+ if (esm !== undefined)
139
+ return esm;
140
+ const parent = pathToFileURL(join(profileDir, 'package.json')).href;
141
+ try {
142
+ return pathToFileURL(createRequire(parent).resolve(spec)).href;
143
+ }
144
+ catch {
145
+ return undefined;
146
+ }
147
+ }
148
+ function versionOf(value) {
149
+ const version = value['apiVersion'];
150
+ return typeof version === 'number' && Number.isInteger(version) ? version : undefined;
151
+ }
152
+ export function validateAdapterSet(value, spec) {
153
+ if (typeof value !== 'object' || value === null) {
154
+ return failure('missing-member', `${spec} 的 createAdapterSet(ctx) 没回一个对象`, spec);
155
+ }
156
+ const record = value;
157
+ const version = versionOf(record);
158
+ if (version === undefined || !SUPPORTED_ADAPTER_API_VERSIONS.includes(version)) {
159
+ return failure('incompatible-version', `${spec} 的适配器协议版本是 ${String(record['apiVersion'])},工作台只认 v${ADAPTER_SET_API_VERSION};v1 集合要补 data.plan 与 data.submitPlan 并升到 v2`, spec);
160
+ }
161
+ const missing = CORE_MEMBERS.filter((member) => record[member] === undefined || record[member] === null);
162
+ for (const [member, method] of CORE_METHODS) {
163
+ if (typeof methodOf(record, member, method) !== 'function')
164
+ missing.push(`${member}.${method}`);
165
+ }
166
+ if (typeof record['id'] !== 'string' || record['id'].trim() === '')
167
+ missing.push('id');
168
+ if (typeof record['version'] !== 'string' || record['version'].trim() === '')
169
+ missing.push('version');
170
+ if (FULL_MEMBERS.some((member) => record[member] !== undefined)) {
171
+ for (const member of FULL_MEMBERS) {
172
+ if (typeof record[member] !== 'object' || record[member] === null)
173
+ missing.push(member);
174
+ }
175
+ for (const [member, method] of FULL_METHODS) {
176
+ if (typeof methodOf(record, member, method) !== 'function')
177
+ missing.push(`${member}.${method}`);
178
+ }
179
+ }
180
+ if (missing.length > 0) {
181
+ const hint = missing.includes('data.submitPlan')
182
+ ? '(适配器集合要补写计划 data.submitPlan)'
183
+ : missing.includes('data.plan')
184
+ ? '(适配器集合要补多跳读取 data.plan)'
185
+ : '';
186
+ return failure('missing-member', `${spec} 少了 ${missing.join(' / ')}${hint}`, spec);
187
+ }
188
+ return { ok: true, spec, set: record };
189
+ }
190
+ export async function loadAdapterSet(ctx, spec) {
191
+ const wanted = typeof spec === 'string' ? spec.trim() : spec === undefined ? '' : String(spec).trim();
192
+ if (wanted === '')
193
+ return failure('not-configured', '没有配置 adapterSet');
194
+ const profileDir = profileDirOf(ctx);
195
+ if (profileDir === null)
196
+ return failure('no-profile', '找不到 profile 目录,无法从 profile 解析适配器集合', wanted);
197
+ if (!isPackageName(wanted)) {
198
+ return failure('malformed', `适配器集合要写包名(如 @acme/adapters-set),收到 ${JSON.stringify(wanted)}`, wanted);
199
+ }
200
+ const url = resolveFromProfile(wanted, profileDir);
201
+ if (url === undefined) {
202
+ return failure('not-resolvable', `在 profile 里解析不到 ${wanted},先把它装进这个 profile`, wanted);
203
+ }
204
+ let mod;
205
+ try {
206
+ mod = (await import(url));
207
+ }
208
+ catch (error) {
209
+ return failure('import-failed', `${wanted} 的入口没加载成:${String(error)}`, wanted, error);
210
+ }
211
+ const factory = mod['createAdapterSet'] ?? mod['default'];
212
+ if (typeof factory !== 'function') {
213
+ return failure('bad-export', `${wanted} 没导出 createAdapterSet(ctx),导出键:${Object.keys(mod).join(', ')}`, wanted);
214
+ }
215
+ let value;
216
+ try {
217
+ const raw = await factory(ctx);
218
+ if (typeof raw !== 'object' || raw === null) {
219
+ return failure('missing-member', `${wanted} 的 createAdapterSet(ctx) 没回一个对象`, wanted);
220
+ }
221
+ value = raw;
222
+ }
223
+ catch (error) {
224
+ return failure('factory-failed', `${wanted} 的 createAdapterSet(ctx) 抛了:${String(error)}`, wanted, error);
225
+ }
226
+ return validateAdapterSet(value, wanted);
227
+ }
228
+ export function withDefaultAdapterSet(defaults, loaded) {
229
+ if (!loaded.ok)
230
+ return defaults;
231
+ const set = loaded.set;
232
+ return {
233
+ apiVersion: set.apiVersion ?? defaults.apiVersion,
234
+ id: set.id ?? defaults.id,
235
+ version: set.version ?? defaults.version,
236
+ data: set.data ?? defaults.data,
237
+ libs: set.libs ?? defaults.libs,
238
+ supply: set.supply ?? defaults.supply,
239
+ modules: set.modules ?? defaults.modules,
240
+ profile: set.profile ?? defaults.profile,
241
+ probe: set.probe ?? defaults.probe,
242
+ runtime: set.runtime ?? defaults.runtime,
243
+ plugins: set.plugins ?? defaults.plugins,
244
+ actions: set.actions ?? defaults.actions,
245
+ };
246
+ }
247
+ function isFullAdapterSet(value) {
248
+ const candidate = value;
249
+ return ['modules', 'runtime', 'plugins', 'actions'].every((member) => typeof candidate[member] === 'object' && candidate[member] !== null);
250
+ }
251
+ export async function resolveAdapterSet(ctx, spec, makeDefaults) {
252
+ const load = await loadAdapterSet(ctx, spec);
253
+ if (load.ok && isFullAdapterSet(load.set)) {
254
+ return { set: load.set, load, usedDefaults: false };
255
+ }
256
+ const defaults = await makeDefaults();
257
+ return { set: withDefaultAdapterSet(defaults, load), load, usedDefaults: true };
258
+ }
@@ -0,0 +1,87 @@
1
+ import type { BundleCancellation, BundleChange, BundleInspection, BundleInstallRequest, BundleRegistries, BundleRegistry, BundleUpdateOutcome, BundleUpdateRequest, BundleVersionList } from '../contract/protocol/bundle-install.js';
2
+ export type InstalledModule = {
3
+ readonly kind: 'module';
4
+ readonly pkg: string;
5
+ readonly unit: string;
6
+ readonly version: string;
7
+ readonly registry?: string;
8
+ readonly local?: boolean;
9
+ } | {
10
+ readonly kind: 'not-module';
11
+ readonly pkg: string;
12
+ } | {
13
+ readonly kind: 'unknown';
14
+ readonly pkg: string;
15
+ };
16
+ export interface ProfileModule {
17
+ readonly pkg: string;
18
+ readonly unit: string;
19
+ readonly version: string;
20
+ readonly registry?: string;
21
+ readonly local?: boolean;
22
+ readonly fromRegistry?: boolean;
23
+ }
24
+ export interface ProfilePackage {
25
+ readonly pkg: string;
26
+ readonly version: string;
27
+ readonly registry?: string;
28
+ readonly local?: boolean;
29
+ }
30
+ export interface BundleManager {
31
+ registries(): Promise<BundleRegistries | null>;
32
+ inspect(spec: string, registry?: BundleRegistry): Promise<BundleInspection | null>;
33
+ install(request: BundleInstallRequest): Promise<BundleChange | null>;
34
+ remove(name: string): Promise<BundleChange | null>;
35
+ setEnabled?(name: string, enabled: boolean): Promise<BundleChange | null>;
36
+ cancel(requestId: string): Promise<BundleCancellation | null>;
37
+ listVersions?(name: string, registry?: BundleRegistry): Promise<BundleVersionList | null>;
38
+ updateBundle?(name: string, version: string, request?: BundleUpdateRequest): Promise<BundleUpdateOutcome | null>;
39
+ waitForInstall?(requestId: string): Promise<BundleChange | null>;
40
+ }
41
+ export interface RegistryEntry {
42
+ readonly scope: string;
43
+ readonly registry: string;
44
+ }
45
+ export interface RegistryNotebook {
46
+ sources(): readonly RegistryEntry[];
47
+ remember(entries: readonly RegistryEntry[]): readonly string[];
48
+ swapScope?(scope: string, registry: string): () => void;
49
+ }
50
+ export interface SelfUpdatePaths {
51
+ readonly dir: string;
52
+ readonly planFile: string;
53
+ readonly marker: string;
54
+ readonly log: string;
55
+ readonly versionsDir: string;
56
+ }
57
+ export interface SelfUpdateRequest {
58
+ readonly dshHome: string;
59
+ readonly profile: string;
60
+ readonly pkg: string;
61
+ readonly from: string;
62
+ readonly to: string;
63
+ readonly running?: string | undefined;
64
+ readonly dshVersion?: string | undefined;
65
+ readonly pinned: boolean;
66
+ }
67
+ export interface SelfUpdateStart {
68
+ readonly started: boolean;
69
+ readonly paths: SelfUpdatePaths;
70
+ readonly forward: string;
71
+ }
72
+ export interface RuntimeStatus {
73
+ readonly command: string;
74
+ readonly source: 'env' | 'isolated' | 'path';
75
+ readonly isolated: string | null;
76
+ }
77
+ export declare function scopeOf(pkg: string): string | null;
78
+ export declare function normalizeRegistry(url: string): string;
79
+ export declare function sameRegistry(a: string | null | undefined, b: string | null | undefined): boolean;
80
+ export declare function registryFailure(change: {
81
+ application?: string;
82
+ packageResult?: {
83
+ kind?: string;
84
+ output?: string;
85
+ };
86
+ errorDetail?: string;
87
+ }): boolean;
@@ -0,0 +1,23 @@
1
+ export function scopeOf(pkg) {
2
+ const slash = pkg.indexOf('/');
3
+ return pkg.startsWith('@') && slash > 1 ? pkg.slice(0, slash) : null;
4
+ }
5
+ export function normalizeRegistry(url) {
6
+ const trimmed = url.trim();
7
+ return trimmed.endsWith('/') ? trimmed : `${trimmed}/`;
8
+ }
9
+ export function sameRegistry(a, b) {
10
+ if (a === null || a === undefined || b === null || b === undefined)
11
+ return false;
12
+ if (a.trim() === '' || b.trim() === '')
13
+ return false;
14
+ return normalizeRegistry(a) === normalizeRegistry(b);
15
+ }
16
+ export function registryFailure(change) {
17
+ if (change.application !== 'failed')
18
+ return false;
19
+ if (change.packageResult?.kind === 'not-found')
20
+ return true;
21
+ const output = change.packageResult?.output ?? change.errorDetail ?? '';
22
+ return /ERR_PNPM_[A-Z_]*FETCH/.test(output);
23
+ }
@@ -0,0 +1,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,28 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import type { DataReader } from '../contract/data.js';
3
+ import type { LibReader } from '../contract/lib.js';
4
+ import type { GitReader } from '../contract/git.js';
5
+ import type { CommandReader } from '../contract/command.js';
6
+ import type { EnvSupplyPort, HostActions, ModulePort, PluginSurface, ProbePort, ProfilePort, RuntimePort } from './port-types.js';
7
+ export declare const WORKBENCH_ADAPTERS = "workbenchAdapters";
8
+ export declare const ADAPTER_SET_API_VERSION = 2;
9
+ export declare const SUPPORTED_ADAPTER_API_VERSIONS: readonly number[];
10
+ export interface AdapterSet {
11
+ readonly apiVersion: number;
12
+ readonly id: string;
13
+ readonly version: string;
14
+ readonly data: DataReader;
15
+ readonly libs?: LibReader | undefined;
16
+ readonly git?: GitReader | undefined;
17
+ readonly commands?: CommandReader | undefined;
18
+ readonly supply: EnvSupplyPort;
19
+ readonly modules: ModulePort;
20
+ readonly profile: ProfilePort;
21
+ readonly probe: ProbePort;
22
+ readonly runtime: RuntimePort;
23
+ readonly plugins: PluginSurface;
24
+ readonly actions: HostActions;
25
+ }
26
+ export type CoreAdapterSet = Pick<AdapterSet, 'apiVersion' | 'id' | 'version' | 'data' | 'supply' | 'profile' | 'probe'>;
27
+ export type WorkbenchAdapters = AdapterSet;
28
+ export declare function adaptersOf(ctx: DshHostContext): AdapterSet;
@@ -0,0 +1,9 @@
1
+ export const WORKBENCH_ADAPTERS = 'workbenchAdapters';
2
+ export const ADAPTER_SET_API_VERSION = 2;
3
+ export const SUPPORTED_ADAPTER_API_VERSIONS = [ADAPTER_SET_API_VERSION];
4
+ export function adaptersOf(ctx) {
5
+ const adapters = ctx.get(WORKBENCH_ADAPTERS, false);
6
+ if (adapters !== undefined)
7
+ return adapters;
8
+ throw new Error('workbenchAdapters 未提供');
9
+ }