@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,183 @@
1
+ import { appendFileSync, chmodSync, cpSync, mkdirSync, readdirSync, renameSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
2
+ import { basename, dirname, join } from 'node:path';
3
+ import writeFileAtomic from 'write-file-atomic';
4
+ import { shellKindOf } from './shell-text.js';
5
+ import { dirLinkTypeOf } from './shell-render.js';
6
+ function modeOf(path, mode) {
7
+ if (typeof mode === 'number')
8
+ return mode;
9
+ try {
10
+ return statSync(path).mode & 0o777;
11
+ }
12
+ catch {
13
+ return 0o644;
14
+ }
15
+ }
16
+ function prepareOf(path, options) {
17
+ if (options.mkdir !== false)
18
+ mkdirSync(dirname(path), { recursive: true });
19
+ return modeOf(path, options.mode);
20
+ }
21
+ function atomicOptionsOf(mode, options) {
22
+ return options.fsync === true ? { mode, fsync: true } : { mode };
23
+ }
24
+ /**
25
+ * 把文本写进文件;默认原子写(temp + rename)、目录不存在就建、已有文件保留原权限。
26
+ * @param path 目标文件;父目录按 `mkdir` 决定是否创建。
27
+ * @param text 文本内容。
28
+ * @param options 原子/目录/权限/fsync;`mode` 默认 `'keep'`(新文件 0644)。
29
+ */
30
+ export function writeTextFile(path, text, options = {}) {
31
+ const mode = prepareOf(path, options);
32
+ if (options.atomic === false) {
33
+ writeFileSync(path, text, { mode });
34
+ return;
35
+ }
36
+ writeFileAtomic.sync(path, text, atomicOptionsOf(mode, options));
37
+ }
38
+ /**
39
+ * 只在文件不存在时创建,已存在返回 `false`(不覆盖)。
40
+ * @param path 目标文件。
41
+ * @param text 文本内容。
42
+ * @param options 目录/权限;不参与原子写。
43
+ * @returns 真的创建了为 `true`。
44
+ */
45
+ export function writeTextFileExclusive(path, text, options = {}) {
46
+ const mode = prepareOf(path, options);
47
+ try {
48
+ writeFileSync(path, text, { flag: 'wx', mode });
49
+ return true;
50
+ }
51
+ catch (error) {
52
+ if (error.code === 'EEXIST')
53
+ return false;
54
+ throw error;
55
+ }
56
+ }
57
+ /**
58
+ * 往文件末尾追加文本;文件或目录不存在就建。追加不是原子写,只给「日志/采集」这类只增不改的流。
59
+ * @param path 目标文件。
60
+ * @param text 追加内容。
61
+ */
62
+ export function appendTextFile(path, text) {
63
+ mkdirSync(dirname(path), { recursive: true });
64
+ appendFileSync(path, text, { mode: modeOf(path, 'keep') });
65
+ }
66
+ /**
67
+ * `writeTextFile` 的异步版;语义与默认值相同。
68
+ * @param path 目标文件。
69
+ * @param text 文本内容。
70
+ * @param options 原子/目录/权限/fsync。
71
+ * @returns 落盘完成。
72
+ */
73
+ export async function writeTextFileAsync(path, text, options = {}) {
74
+ const mode = prepareOf(path, options);
75
+ if (options.atomic === false) {
76
+ writeFileSync(path, text, { mode });
77
+ return;
78
+ }
79
+ await writeFileAtomic(path, text, atomicOptionsOf(mode, options));
80
+ }
81
+ /**
82
+ * 把二进制写进文件;语义与默认值同 `writeTextFile`。
83
+ * @param path 目标文件。
84
+ * @param bytes 二进制内容。
85
+ * @param options 原子/目录/权限/fsync。
86
+ */
87
+ export function writeBytesFile(path, bytes, options = {}) {
88
+ const mode = prepareOf(path, options);
89
+ if (options.atomic === false) {
90
+ writeFileSync(path, bytes, { mode });
91
+ return;
92
+ }
93
+ writeFileAtomic.sync(path, Buffer.from(bytes), atomicOptionsOf(mode, options));
94
+ }
95
+ /**
96
+ * `writeBytesFile` 的异步版;语义与默认值相同。
97
+ * @param path 目标文件。
98
+ * @param bytes 二进制内容。
99
+ * @param options 原子/目录/权限/fsync。
100
+ * @returns 落盘完成。
101
+ */
102
+ export async function writeBytesFileAsync(path, bytes, options = {}) {
103
+ const mode = prepareOf(path, options);
104
+ if (options.atomic === false) {
105
+ writeFileSync(path, bytes, { mode });
106
+ return;
107
+ }
108
+ await writeFileAtomic(path, Buffer.from(bytes), atomicOptionsOf(mode, options));
109
+ }
110
+ /**
111
+ * 把 JSON 写进文件:`JSON.stringify(value, null, 2)` 加末尾换行;语义与默认值同 `writeTextFile`。
112
+ * @param path 目标文件。
113
+ * @param value 可序列化的值。
114
+ * @param options 原子/目录/权限/fsync。
115
+ */
116
+ export function writeJsonFile(path, value, options = {}) {
117
+ writeTextFile(path, `${JSON.stringify(value, null, 2)}\n`, options);
118
+ }
119
+ /**
120
+ * `writeJsonFile` 的异步版;语义与默认值相同。
121
+ * @param path 目标文件。
122
+ * @param value 可序列化的值。
123
+ * @param options 原子/目录/权限/fsync。
124
+ * @returns 落盘完成。
125
+ */
126
+ export async function writeJsonFileAsync(path, value, options = {}) {
127
+ await writeTextFileAsync(path, `${JSON.stringify(value, null, 2)}\n`, options);
128
+ }
129
+ /**
130
+ * 确保目录存在(`mkdir -p`)。
131
+ * @param dir 目录路径。
132
+ */
133
+ export function ensureDir(dir) {
134
+ mkdirSync(dir, { recursive: true });
135
+ }
136
+ /**
137
+ * 把已存在的文件设成可执行(0755)。
138
+ * @param path 文件路径。
139
+ */
140
+ export function makeExecutable(path) {
141
+ chmodSync(path, 0o755);
142
+ }
143
+ /**
144
+ * 删掉一个路径(目录整棵删),不存在当成功。
145
+ * @param path 目标路径。
146
+ */
147
+ export function removePath(path) {
148
+ rmSync(path, { recursive: true, force: true });
149
+ }
150
+ /**
151
+ * 把 `from` 目录里的内容倒进 `to` 目录(等价 `cp -R from/. to/`):`to` 先清空再建。
152
+ * @param from 源目录。
153
+ * @param to 目标目录。
154
+ */
155
+ export function copyDirInto(from, to) {
156
+ removePath(to);
157
+ ensureDir(to);
158
+ for (const entry of readdirSync(from)) {
159
+ cpSync(join(from, entry), join(to, basename(entry)), { recursive: true });
160
+ }
161
+ }
162
+ export function moveDir(source, target) {
163
+ try {
164
+ renameSync(source, target);
165
+ }
166
+ catch (error) {
167
+ if (error.code !== 'EXDEV')
168
+ throw error;
169
+ cpSync(source, target, { recursive: true });
170
+ removePath(source);
171
+ }
172
+ }
173
+ /**
174
+ * 建一条指向目录的链接:POSIX 是符号链接,Windows 是 junction(不需要开发者模式或管理员)。
175
+ * @param target 被指向的目录。
176
+ * @param path 链接落在哪。
177
+ * @param kind 目标 shell 种类,默认当前平台。
178
+ */
179
+ export function linkDir(target, path, kind = shellKindOf()) {
180
+ removePath(path);
181
+ ensureDir(dirname(path));
182
+ symlinkSync(target, path, dirLinkTypeOf(kind));
183
+ }
@@ -0,0 +1,5 @@
1
+ export type { BranchRead, HeadRead, OriginRead, } from '../contract/git.js';
2
+ import type { BranchRead, HeadRead, OriginRead } from '../contract/git.js';
3
+ export type OriginReader = (path: string) => Promise<OriginRead>;
4
+ export type BranchReader = (path: string) => Promise<BranchRead>;
5
+ export type HeadReader = (path: string) => Promise<HeadRead>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { HostActions } from './port-types.js';
2
+ export declare function createHostActions(): HostActions;
@@ -0,0 +1,5 @@
1
+ import { configSyncAction, configSyncHandler } from './config-sync.js';
2
+ import { profileCreateAction, profileCreateHandler } from './profile-create.js';
3
+ export function createHostActions() {
4
+ return { configSyncAction, configSyncHandler, profileCreateAction, profileCreateHandler };
5
+ }
@@ -0,0 +1,37 @@
1
+ import type { HostSurface } from '../contract/protocol/platform.js';
2
+ import type { EnvSupplyPort } from './port-types.js';
3
+ import type { UnitSeam } from './seam/unit-seam.js';
4
+ import { type FlowHost } from './flow/kit.js';
5
+ import type { FlowAgentPort, FlowDataPort } from './flow/types.js';
6
+ import type { AiPort } from './ai/port.js';
7
+ import { sessionIdOf, sessionWorkspace } from './tool-kit.js';
8
+ /**
9
+ * 宿主 kit 的公共部分:flow、工具侧 session 读法、外部供给装法、宿主平台事实、按 unit 绑定的执行缝门面。
10
+ */
11
+ export interface HostKit {
12
+ readonly flow: FlowHost;
13
+ readonly sessionIdOf: typeof sessionIdOf;
14
+ readonly sessionWorkspace: typeof sessionWorkspace;
15
+ readonly libInstallCommand: EnvSupplyPort['libInstallCommand'];
16
+ readonly surface: HostSurface;
17
+ readonly seam?: UnitSeam | undefined;
18
+ readonly ai?: AiPort | undefined;
19
+ }
20
+ /**
21
+ * 建一份宿主 kit;每个挂载点一份,没有模块级状态。
22
+ * @param parts.libInstallCommand 拼「装这个共用依赖」的那条命令。
23
+ * @param parts.surface 宿主平台事实;由组合根按 profile 与宿主进程算好再交进来。
24
+ * @param parts.seam 按 unit 绑定好的执行缝门面;模块清单没声明写入域时缺省不给。
25
+ * @param parts.agents 宿主的 agent 端口;没有就不支持流程里的 agent 节点。
26
+ * @param parts.ai 模块用的模型入口;没有就等于这份运行时没有模型。
27
+ * @param parts.data 模块读数据的窄口;没有就不支持流程里的 data 节点。
28
+ * @returns flow / sessionIdOf / sessionWorkspace / libInstallCommand / surface,有门面时带上 seam,有模型时带上 ai。
29
+ */
30
+ export declare function createHostKit(parts: {
31
+ readonly libInstallCommand: EnvSupplyPort['libInstallCommand'];
32
+ readonly surface: HostSurface;
33
+ readonly seam?: UnitSeam | undefined;
34
+ readonly agents?: FlowAgentPort | undefined;
35
+ readonly ai?: AiPort | undefined;
36
+ readonly data?: FlowDataPort | undefined;
37
+ }): HostKit;
@@ -0,0 +1,27 @@
1
+ import { createFlowHost } from './flow/kit.js';
2
+ import { sessionIdOf, sessionWorkspace } from './tool-kit.js';
3
+ /**
4
+ * 建一份宿主 kit;每个挂载点一份,没有模块级状态。
5
+ * @param parts.libInstallCommand 拼「装这个共用依赖」的那条命令。
6
+ * @param parts.surface 宿主平台事实;由组合根按 profile 与宿主进程算好再交进来。
7
+ * @param parts.seam 按 unit 绑定好的执行缝门面;模块清单没声明写入域时缺省不给。
8
+ * @param parts.agents 宿主的 agent 端口;没有就不支持流程里的 agent 节点。
9
+ * @param parts.ai 模块用的模型入口;没有就等于这份运行时没有模型。
10
+ * @param parts.data 模块读数据的窄口;没有就不支持流程里的 data 节点。
11
+ * @returns flow / sessionIdOf / sessionWorkspace / libInstallCommand / surface,有门面时带上 seam,有模型时带上 ai。
12
+ */
13
+ export function createHostKit(parts) {
14
+ return {
15
+ flow: createFlowHost({
16
+ ...(parts.agents === undefined ? {} : { agents: parts.agents }),
17
+ ...(parts.ai === undefined ? {} : { ai: parts.ai }),
18
+ ...(parts.data === undefined ? {} : { data: parts.data }),
19
+ }),
20
+ sessionIdOf,
21
+ sessionWorkspace,
22
+ libInstallCommand: parts.libInstallCommand,
23
+ surface: parts.surface,
24
+ ...(parts.seam === undefined ? {} : { seam: parts.seam }),
25
+ ...(parts.ai === undefined ? {} : { ai: parts.ai }),
26
+ };
27
+ }
@@ -0,0 +1,47 @@
1
+ import type { DshHostContext } from '../api/dsh.js';
2
+ import { type PanelStateStore } from './panel-state.js';
3
+ import { type ProvisionHandler } from './provision.js';
4
+ import type { RuntimeStatus } from './adapter-types.js';
5
+ export type RouteHandler = (search: URLSearchParams) => Promise<unknown> | unknown;
6
+ export type RouteTable = Record<string, RouteHandler>;
7
+ export declare function flag(search: URLSearchParams, name: string): boolean;
8
+ export declare function param(search: URLSearchParams, name: string): string | undefined;
9
+ export declare function registerApi(ctx: DshHostContext, routes: RouteTable): () => void;
10
+ export declare function registerProvision(ctx: DshHostContext, provision: ProvisionHandler, log?: {
11
+ bump(facts: readonly string[]): unknown;
12
+ } | undefined): () => void;
13
+ export interface PostResource {
14
+ readonly resource: string;
15
+ readonly unit?: string;
16
+ readonly redact?: boolean | undefined;
17
+ handle(payload: unknown): Promise<unknown> | unknown;
18
+ }
19
+ export interface PostWrite {
20
+ readonly args?: unknown;
21
+ readonly result: unknown;
22
+ }
23
+ export declare function changesHandler(log: {
24
+ epoch(): string;
25
+ since(rev: number): {
26
+ rev: number;
27
+ facts: readonly string[];
28
+ };
29
+ }): RouteHandler;
30
+ export declare function preflightHandler(preflight: {
31
+ run(options?: {
32
+ hard?: boolean;
33
+ only?: string;
34
+ }): Promise<unknown>;
35
+ snapshot(): unknown;
36
+ }): RouteHandler;
37
+ export declare function capabilityHandler(probe: (unit: string | undefined, force: boolean) => Promise<unknown> | unknown): RouteHandler;
38
+ export declare function healthHandler(ctx: DshHostContext, runtimes?: Readonly<Record<string, RuntimeStatus>>): RouteHandler;
39
+ export declare function registerPrefs(ctx: DshHostContext, resources: readonly PostResource[], wrote?: ((resource: string, write: PostWrite) => void) | undefined): () => void;
40
+ export declare function registerActions(ctx: DshHostContext, resources: readonly PostResource[], wrote?: ((resource: string, write: PostWrite) => void) | undefined): () => void;
41
+ export declare function registerPanelState(ctx: DshHostContext, store: PanelStateStore): () => void;
42
+ export declare function registerDiyDebugAct(ctx: DshHostContext, resource: PostResource, log?: {
43
+ bump(facts: readonly string[]): unknown;
44
+ } | undefined): () => void;
45
+ export declare function registerDiyRecordAct(ctx: DshHostContext, resource: PostResource, log?: {
46
+ bump(facts: readonly string[]): unknown;
47
+ } | undefined): () => void;
@@ -0,0 +1,289 @@
1
+ import { now, nowIso } from './time.js';
2
+ import { unitFactScope } from './facts.js';
3
+ import { parseCardsReport, parseCrashReport } from './panel-state.js';
4
+ import { ACTIONS_PREFIX, API_PREFIX, DIY_DEBUG_PATH, DIY_RECORD_PATH, PANEL_STATE_PREFIX, PLUGIN_ID, PREFS_PREFIX, PROVISION_PREFIX } from '../config/constants.js';
5
+ import { parseProvisionBody, provisionTargetOf, } from './provision.js';
6
+ import { WorkbenchDataError } from './data-error.js';
7
+ import { writeResultForClient } from './write-result.js';
8
+ const MAX_PREFS_BODY_BYTES = 8 * 1024;
9
+ const PROVISION_FACTS = ['capability', 'panels'];
10
+ function provisionFacts(provision, request) {
11
+ const scopes = (provision.affectedUnits?.(request) ?? []).map(unitFactScope);
12
+ return [...PROVISION_FACTS, ...scopes];
13
+ }
14
+ function sendJson(res, status, body) {
15
+ res.statusCode = status;
16
+ res.setHeader('content-type', 'application/json; charset=utf-8');
17
+ res.setHeader('cache-control', 'no-store');
18
+ res.end(JSON.stringify(body));
19
+ }
20
+ function isDataError(error) {
21
+ if (error instanceof WorkbenchDataError)
22
+ return true;
23
+ return (error instanceof Error &&
24
+ error.name === 'WorkbenchDataError' &&
25
+ typeof error.code === 'string');
26
+ }
27
+ function toErrorPayload(error) {
28
+ if (isDataError(error)) {
29
+ const data = error;
30
+ return {
31
+ code: data.code,
32
+ message: data.message,
33
+ ...(data.detail === undefined ? {} : { detail: data.detail }),
34
+ ...(data.hint === undefined ? {} : { hint: data.hint }),
35
+ ...(data.helpUrl === undefined ? {} : { helpUrl: data.helpUrl }),
36
+ ...(data.project === undefined ? {} : { project: data.project }),
37
+ ...(data.failure === undefined ? {} : { failure: data.failure }),
38
+ };
39
+ }
40
+ return { code: 'internal', message: error instanceof Error ? error.message : String(error) };
41
+ }
42
+ export function flag(search, name) {
43
+ const raw = search.get(name);
44
+ if (raw === null)
45
+ return false;
46
+ return raw === '' || raw === '1' || raw.toLowerCase() === 'true';
47
+ }
48
+ export function param(search, name) {
49
+ const raw = search.get(name);
50
+ return raw === null || raw === '' ? undefined : raw;
51
+ }
52
+ export function registerApi(ctx, routes) {
53
+ return ctx.webServer.register({
54
+ kind: 'prefix',
55
+ path: API_PREFIX,
56
+ handler: async (req, res) => {
57
+ const raw = req.url ?? '/';
58
+ const cut = raw.indexOf('?');
59
+ const pathname = cut === -1 ? raw : raw.slice(0, cut);
60
+ const search = new URLSearchParams(cut === -1 ? '' : raw.slice(cut + 1));
61
+ const route = pathname.slice(API_PREFIX.length).replace(/^\//, '');
62
+ if (req.method !== 'GET') {
63
+ sendJson(res, 405, { ok: false, error: { code: 'method-not-allowed', message: '只支持 GET' } });
64
+ return;
65
+ }
66
+ const handler = Object.prototype.hasOwnProperty.call(routes, route) ? routes[route] : undefined;
67
+ if (handler === undefined) {
68
+ sendJson(res, 404, { ok: false, error: { code: 'not-found', message: `没有这个接口:${route}` } });
69
+ return;
70
+ }
71
+ try {
72
+ sendJson(res, 200, await handler(search));
73
+ }
74
+ catch (error) {
75
+ if (isDataError(error)) {
76
+ sendJson(res, 200, { ok: false, error: toErrorPayload(error) });
77
+ return;
78
+ }
79
+ ctx.logger?.warn?.(`[dsh-workbench] 路由 ${route} 失败:${String(error)}`);
80
+ sendJson(res, 500, { ok: false, error: toErrorPayload(error) });
81
+ }
82
+ },
83
+ });
84
+ }
85
+ export function registerProvision(ctx, provision, log) {
86
+ return ctx.webServer.register({
87
+ kind: 'prefix',
88
+ path: PROVISION_PREFIX,
89
+ handler: async (req, res) => {
90
+ if (req.method !== 'POST') {
91
+ sendJson(res, 405, { ok: false, error: { code: 'method-not-allowed', message: '机器供给只支持 POST' } });
92
+ return;
93
+ }
94
+ let payload;
95
+ try {
96
+ const raw = await readBoundedBody(req);
97
+ if (raw === null) {
98
+ sendJson(res, 413, { ok: false, error: { code: 'body-too-large', message: '请求体太大' } });
99
+ return;
100
+ }
101
+ payload = raw === '' ? {} : JSON.parse(raw);
102
+ }
103
+ catch (error) {
104
+ sendJson(res, 400, { ok: false, error: { code: 'bad-json', message: String(error) } });
105
+ return;
106
+ }
107
+ const parsed = parseProvisionBody(payload);
108
+ if (!parsed.ok) {
109
+ sendJson(res, 400, { ok: false, error: { code: parsed.code, message: parsed.message } });
110
+ return;
111
+ }
112
+ const request = parsed.request;
113
+ try {
114
+ const result = await provision.handle(request);
115
+ log?.bump(provisionFacts(provision, request));
116
+ sendJson(res, 200, result);
117
+ }
118
+ catch (error) {
119
+ log?.bump(provisionFacts(provision, request));
120
+ const target = request[provisionTargetOf(request.action)] ?? '';
121
+ ctx.logger?.warn?.(`[dsh-workbench] provision ${request.action} ${target} 失败:${error instanceof Error ? error.message : String(error)}`);
122
+ sendJson(res, 200, { ok: false, error: toErrorPayload(error) });
123
+ }
124
+ },
125
+ });
126
+ }
127
+ function registerPost(ctx, options) {
128
+ const { prefix, what, resources, refusedCode, wrote } = options;
129
+ const table = new Map(resources.map((item) => [item.resource, item]));
130
+ return ctx.webServer.register({
131
+ kind: 'prefix',
132
+ path: prefix,
133
+ handler: async (req, res) => {
134
+ if (req.method !== 'POST') {
135
+ sendJson(res, 405, { ok: false, error: { code: 'method-not-allowed', message: `${what}只支持 POST` } });
136
+ return;
137
+ }
138
+ const raw = await readBoundedBody(req);
139
+ if (raw === null) {
140
+ sendJson(res, 413, { ok: false, error: { code: 'payload-too-large', message: '请求体过大' } });
141
+ return;
142
+ }
143
+ let payload;
144
+ try {
145
+ payload = raw === '' ? {} : JSON.parse(raw);
146
+ }
147
+ catch {
148
+ sendJson(res, 400, { ok: false, error: { code: 'bad-json', message: '请求体不是 JSON' } });
149
+ return;
150
+ }
151
+ const requested = (req.url ?? '/').slice(prefix.length).replace(/^\//, '').split('?')[0] ?? '';
152
+ const resource = table.get(requested);
153
+ if (resource === undefined) {
154
+ sendJson(res, 404, { ok: false, error: { code: 'not-found', message: `没有这个${what}资源:${requested}` } });
155
+ return;
156
+ }
157
+ try {
158
+ const result = await resource.handle(payload);
159
+ wrote?.(requested, { ...(resource.redact === true ? {} : { args: payload }), result });
160
+ sendJson(res, 200, writeResultForClient(result, refusedCode));
161
+ }
162
+ catch (error) {
163
+ sendJson(res, 200, { ok: false, error: toErrorPayload(error) });
164
+ }
165
+ },
166
+ });
167
+ }
168
+ async function readBoundedBody(req) {
169
+ if (typeof req[Symbol.asyncIterator] !== 'function')
170
+ return '';
171
+ const chunks = [];
172
+ let size = 0;
173
+ for await (const chunk of req) {
174
+ size += chunk.byteLength;
175
+ if (size > MAX_PREFS_BODY_BYTES)
176
+ return null;
177
+ chunks.push(chunk);
178
+ }
179
+ return Buffer.concat(chunks).toString('utf8');
180
+ }
181
+ export function changesHandler(log) {
182
+ return (search) => ({ ok: true, epoch: log.epoch(), ...log.since(Number(param(search, 'since') ?? 0) || 0) });
183
+ }
184
+ export function preflightHandler(preflight) {
185
+ return (search) => {
186
+ if (flag(search, 'hard')) {
187
+ void preflight.run({ hard: true });
188
+ return { ok: true, ...preflight.snapshot() };
189
+ }
190
+ const only = param(search, 'only');
191
+ if (only !== undefined && only !== '') {
192
+ void preflight.run({ only });
193
+ return { ok: true, ...preflight.snapshot() };
194
+ }
195
+ const snapshot = preflight.snapshot();
196
+ void preflight.run({ hard: false });
197
+ return { ok: true, ...snapshot };
198
+ };
199
+ }
200
+ export function capabilityHandler(probe) {
201
+ return async (search) => {
202
+ const unit = param(search, 'unit');
203
+ const result = await probe(unit, flag(search, 'force'));
204
+ if (result === undefined) {
205
+ return { ok: false, error: { code: 'workbench/unknown-unit', message: `没有这个单元:${unit}` } };
206
+ }
207
+ return { ok: true, ...result };
208
+ };
209
+ }
210
+ export function healthHandler(ctx, runtimes) {
211
+ return () => {
212
+ const profile = ctx.get('profileContext');
213
+ const dir = profile?.dir;
214
+ return {
215
+ ok: true,
216
+ plugin: PLUGIN_ID,
217
+ profile: dir === undefined ? null : dir.split('/').pop(),
218
+ profileDir: dir ?? null,
219
+ pid: process.pid,
220
+ now: nowIso(),
221
+ ...(runtimes === undefined ? {} : { runtimes }),
222
+ };
223
+ };
224
+ }
225
+ export function registerPrefs(ctx, resources, wrote) {
226
+ return registerPost(ctx, {
227
+ prefix: PREFS_PREFIX,
228
+ what: '偏好写',
229
+ refusedCode: 'write-refused',
230
+ resources,
231
+ ...(wrote === undefined ? {} : { wrote }),
232
+ });
233
+ }
234
+ export function registerActions(ctx, resources, wrote) {
235
+ return registerPost(ctx, {
236
+ prefix: ACTIONS_PREFIX,
237
+ what: '动作',
238
+ refusedCode: 'action-refused',
239
+ resources,
240
+ ...(wrote === undefined ? {} : { wrote }),
241
+ });
242
+ }
243
+ export function registerPanelState(ctx, store) {
244
+ return registerPost(ctx, {
245
+ prefix: PANEL_STATE_PREFIX,
246
+ what: '面板运行态',
247
+ refusedCode: 'report-refused',
248
+ resources: [
249
+ {
250
+ resource: 'cards',
251
+ handle(payload) {
252
+ const parsed = parseCardsReport(payload);
253
+ if (!parsed.ok)
254
+ return { ok: false, text: parsed.message };
255
+ store.cards(parsed.value);
256
+ return { ok: true, at: now() };
257
+ },
258
+ },
259
+ {
260
+ resource: 'crash',
261
+ handle(payload) {
262
+ const parsed = parseCrashReport(payload);
263
+ if (!parsed.ok)
264
+ return { ok: false, text: parsed.message };
265
+ store.crash(parsed.value);
266
+ return { ok: true, at: now() };
267
+ },
268
+ },
269
+ ],
270
+ });
271
+ }
272
+ export function registerDiyDebugAct(ctx, resource, log) {
273
+ return registerPost(ctx, {
274
+ prefix: `${API_PREFIX}/${DIY_DEBUG_PATH}`,
275
+ what: '工作台 DIY 调试动作',
276
+ refusedCode: 'action-refused',
277
+ resources: [resource],
278
+ wrote: () => log?.bump(['diy-debug']),
279
+ });
280
+ }
281
+ export function registerDiyRecordAct(ctx, resource, log) {
282
+ return registerPost(ctx, {
283
+ prefix: `${API_PREFIX}/${DIY_RECORD_PATH}`,
284
+ what: '工作台 DIY 录制交接动作',
285
+ refusedCode: 'action-refused',
286
+ resources: [resource],
287
+ wrote: () => log?.bump(['diy-record']),
288
+ });
289
+ }
@@ -0,0 +1,50 @@
1
+ import type { InstallFailure, InstallFailureKind } from '../contract/command.js';
2
+ export interface DirFacts {
3
+ readonly mode: string;
4
+ readonly owner: {
5
+ readonly uid: number;
6
+ readonly gid: number;
7
+ };
8
+ readonly writable: boolean;
9
+ }
10
+ export declare function commandTokens(command: string): string[];
11
+ export declare function installVerbAt(command: string): number | undefined;
12
+ export declare function installTargets(command: string): string[];
13
+ export declare function failurePathIn(output: string): string | undefined;
14
+ export declare function nearestDir(path: string): string | undefined;
15
+ export type WriteState = 'ok' | 'denied' | 'unknown';
16
+ export declare function writeStateOf(dir: string, access?: (dir: string, mode: number) => void): WriteState;
17
+ export declare function dirFacts(dir: string): DirFacts | undefined;
18
+ export declare function currentUser(): {
19
+ readonly uid: number;
20
+ readonly gid: number;
21
+ };
22
+ export declare function classifyInstallFailure(output: string): InstallFailureKind;
23
+ export interface InstallFailureFacts {
24
+ readonly command: string;
25
+ readonly exitCode: number | null;
26
+ readonly output: string;
27
+ readonly kind?: InstallFailureKind | undefined;
28
+ readonly path?: string | undefined;
29
+ readonly mode?: string | undefined;
30
+ readonly owner?: {
31
+ readonly uid: number;
32
+ readonly gid: number;
33
+ } | undefined;
34
+ readonly writable?: boolean | undefined;
35
+ readonly current: {
36
+ readonly uid: number;
37
+ readonly gid: number;
38
+ };
39
+ }
40
+ export declare function installFailureOf(facts: InstallFailureFacts): InstallFailure;
41
+ export declare function diagnoseInstallFailure(input: {
42
+ readonly command: string;
43
+ readonly exitCode: number | null;
44
+ readonly output: string;
45
+ readonly fallback?: string | undefined;
46
+ }): InstallFailure;
47
+ export declare function installWriteProblem(input: {
48
+ readonly command: string;
49
+ readonly fallback?: string | undefined;
50
+ }): InstallFailure | undefined;