@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,332 @@
1
+ import { authLossScriptLines } from './auth-loss.js';
2
+ import { callsProblemOf, DEFAULT_RECIPE_MAX_BYTES, recipeProblemOf } from './recipe-rules.js';
3
+ function authOf(recipe) {
4
+ return recipe.auth ?? { source: { kind: 'cookie' }, place: { in: 'cookie' } };
5
+ }
6
+ function needsToken(auth) {
7
+ return auth.kind !== 'none' && auth.source.kind !== 'cookie';
8
+ }
9
+ function mergedHeaders(recipe, overrides) {
10
+ return { ...(recipe.request.headers ?? {}), ...(overrides.headers ?? {}) };
11
+ }
12
+ function mergedQuery(recipe, overrides) {
13
+ const query = {};
14
+ for (const [name, value] of Object.entries(recipe.request.query ?? {}))
15
+ query[name] = String(value);
16
+ for (const [name, value] of Object.entries(overrides.query ?? {}))
17
+ query[name] = String(value);
18
+ return query;
19
+ }
20
+ function baseUrlOf(recipe, overrides) {
21
+ const path = overrides.path ?? recipe.request.path;
22
+ return path.startsWith('/') ? `${originOf(recipe)}${path}` : path;
23
+ }
24
+ function originOf(recipe) {
25
+ if (recipe.origin === undefined || recipe.origin === '') {
26
+ throw new Error('这条配方还没解析站点:缺少 origin(只写 site 的配方要先经宿主解析)');
27
+ }
28
+ return recipe.origin;
29
+ }
30
+ function urlOf(recipe, overrides) {
31
+ const url = new URL(baseUrlOf(recipe, overrides));
32
+ for (const [name, value] of Object.entries(mergedQuery(recipe, overrides))) {
33
+ url.searchParams.set(name, value);
34
+ }
35
+ return url.toString();
36
+ }
37
+ function responseOf(recipe, overrides) {
38
+ const base = recipe.response;
39
+ const extra = overrides.response ?? {};
40
+ return {
41
+ kind: extra.kind ?? base?.kind ?? 'json',
42
+ path: extra.path ?? base?.path,
43
+ maxBytes: extra.maxBytes ?? base?.maxBytes ?? DEFAULT_RECIPE_MAX_BYTES,
44
+ };
45
+ }
46
+ function bodyOf(recipe, overrides) {
47
+ return overrides.body !== undefined ? overrides.body : recipe.request.body;
48
+ }
49
+ function quote(value) {
50
+ return JSON.stringify(value);
51
+ }
52
+ function literal(value) {
53
+ return JSON.stringify(value);
54
+ }
55
+ function encodedBody(value) {
56
+ return typeof value === 'string' ? literal(value) : `JSON.stringify(${literal(value)})`;
57
+ }
58
+ function tokenLines(recipe, auth, origin) {
59
+ if (!needsToken(auth))
60
+ return [];
61
+ const source = auth.kind === 'none' ? undefined : auth.source;
62
+ if (source === undefined)
63
+ return [];
64
+ if (source.kind === 'cookieValue') {
65
+ return [
66
+ ' const cookie = (name) => {',
67
+ ' const hit = document.cookie.split("; ").find((one) => one.startsWith(name + "="));',
68
+ ' return hit === undefined ? "" : decodeURIComponent(hit.slice(name.length + 1));',
69
+ ' };',
70
+ ` const token = cookie(${quote(source.name)});`,
71
+ ' if (token === "") return { ok: false, code: "auth-failed", message: "页面里没有这个 cookie" };',
72
+ ];
73
+ }
74
+ if (source.kind === 'meta') {
75
+ return [
76
+ ` const meta = document.querySelector(${quote(`meta[name="${source.name}"]`)});`,
77
+ ' const token = meta === null ? "" : (meta.getAttribute("content") || "");',
78
+ ' if (token === "") return { ok: false, code: "auth-failed", message: "页面里没有这个 meta" };',
79
+ ];
80
+ }
81
+ if (source.kind === 'global') {
82
+ return [
83
+ ` const token = pick(globalThis, ${quote(source.path)});`,
84
+ ' if (typeof token !== "string" || token === "") return { ok: false, code: "auth-failed", message: "页面里没有这个全局变量" };',
85
+ ];
86
+ }
87
+ if (source.kind === 'storage') {
88
+ const store = source.area === 'local' ? 'localStorage' : 'sessionStorage';
89
+ const path = source.path === undefined ? '' : source.path;
90
+ return [
91
+ ` const raw = ${store}.getItem(${quote(source.key)});`,
92
+ ' let parsed = raw;',
93
+ ' try { parsed = raw === null ? null : JSON.parse(raw); } catch (error) { parsed = raw; }',
94
+ path === ''
95
+ ? ' const token = parsed;'
96
+ : ` const token = pick(parsed, ${quote(path)});`,
97
+ ' if (typeof token !== "string" || token === "") return { ok: false, code: "auth-failed", message: "页面里没有这个 token" };',
98
+ ];
99
+ }
100
+ if (source.kind === 'endpoint') {
101
+ const method = source.method ?? 'GET';
102
+ const hasBody = source.body !== undefined;
103
+ const endpointUrl = source.url.startsWith('/') ? `${origin}${source.url}` : source.url;
104
+ const lines = [
105
+ ' let pre;',
106
+ ' try {',
107
+ ` pre = await fetch(${quote(endpointUrl)}, { method: ${quote(method)}, credentials: "include", headers: { "content-type": "application/json" }${hasBody ? `, body: ${encodedBody(source.body)}` : ''} });`,
108
+ ' } catch (error) {',
109
+ ' return { ok: false, code: "fetch-failed", message: String(error) };',
110
+ ' }',
111
+ ' if (pre.status === 401) return { ok: false, code: "not-logged-in" };',
112
+ ' if (pre.status === 403) return { ok: false, code: "forbidden" };',
113
+ ' const preText = await pre.text();',
114
+ ' if (!pre.ok) return { ok: false, code: "http-" + pre.status, message: preText.slice(0, 200) };',
115
+ ' let preJson;',
116
+ ' try { preJson = JSON.parse(preText); } catch (error) {',
117
+ ' return { ok: false, code: "shape", message: "换登录态时返回的不是 JSON" };',
118
+ ' }',
119
+ ` const token = pick(preJson, ${quote(source.path)});`,
120
+ ' if (typeof token !== "string" || token === "") return { ok: false, code: "auth-failed", message: "换登录态时没拿到 token" };',
121
+ ];
122
+ return lines;
123
+ }
124
+ return [];
125
+ }
126
+ function fetchLine(recipe, hasBody) {
127
+ return ` res = await fetch(url, { method: ${quote(recipe.request.method)}, credentials: "include", headers${hasBody ? ', body' : ''} });`;
128
+ }
129
+ export function scriptOf(recipe, overrides = {}) {
130
+ const problem = recipeProblemOf(recipe, overrides);
131
+ if (problem !== undefined)
132
+ throw new Error(problem);
133
+ const origin = originOf(recipe);
134
+ const auth = authOf(recipe);
135
+ const body = bodyOf(recipe, overrides);
136
+ const contentType = recipe.request.contentType ?? 'json';
137
+ const place = auth.kind === 'none' ? undefined : auth.place;
138
+ const bodyPlace = place?.in === 'body' ? place : undefined;
139
+ const hasBody = body !== undefined || bodyPlace !== undefined;
140
+ const headers = mergedHeaders(recipe, overrides);
141
+ const headerNames = Object.keys(headers).map((name) => name.toLowerCase());
142
+ if (hasBody && !headerNames.includes('content-type')) {
143
+ headers['content-type'] = contentType === 'form' ? 'application/x-www-form-urlencoded' : 'application/json';
144
+ }
145
+ const url = urlOf(recipe, overrides);
146
+ const { kind: responseKind, path: responsePath, maxBytes } = responseOf(recipe, overrides);
147
+ const lines = [];
148
+ lines.push('(async () => {');
149
+ lines.push(` if (location.origin !== ${quote(origin)}) return { ok: false, code: "not-on-site" };`);
150
+ lines.push(' const pick = (value, path) => path.split(".").filter((key) => key !== "").reduce((one, key) => (one === null || one === undefined ? one : one[key]), value);');
151
+ lines.push(' const set = (target, path, value) => { const parts = path.split("."); let at = target; for (let index = 0; index < parts.length - 1; index += 1) { const key = parts[index]; if (at[key] === null || typeof at[key] !== "object") at[key] = {}; at = at[key]; } at[parts[parts.length - 1]] = value; return target; };');
152
+ lines.push(...tokenLines(recipe, auth, origin));
153
+ if (recipe.authLoss !== undefined)
154
+ lines.push(...authLossScriptLines(recipe.authLoss));
155
+ lines.push(` const headers = ${literal(headers)};`);
156
+ if (place?.in === 'header' && needsToken(auth)) {
157
+ lines.push(` headers[${quote(place.name)}] = ${quote(place.prefix ?? '')} + token;`);
158
+ }
159
+ if (hasBody) {
160
+ if (contentType === 'form') {
161
+ lines.push(` const body = new URLSearchParams(${literal(body ?? {})});`);
162
+ if (bodyPlace !== undefined)
163
+ lines.push(` body.set(${quote(bodyPlace.field)}, token);`);
164
+ }
165
+ else {
166
+ lines.push(` let body = ${literal(body ?? {})};`);
167
+ if (bodyPlace !== undefined)
168
+ lines.push(` set(body, ${quote(bodyPlace.field)}, token);`);
169
+ lines.push(' if (typeof body !== "string") body = JSON.stringify(body);');
170
+ }
171
+ }
172
+ lines.push(` let url = ${quote(url)};`);
173
+ if (place?.in === 'query' && needsToken(auth)) {
174
+ lines.push(` url += (url.indexOf("?") === -1 ? "?" : "&") + ${quote(`${place.name}=`)} + encodeURIComponent(token);`);
175
+ }
176
+ lines.push(' let res;');
177
+ lines.push(' try {');
178
+ lines.push(fetchLine(recipe, hasBody));
179
+ lines.push(' } catch (error) {');
180
+ lines.push(' return { ok: false, code: "fetch-failed", message: String(error) };');
181
+ lines.push(' }');
182
+ lines.push(' const text = await res.text();');
183
+ lines.push(' if (res.status === 401) return { ok: false, code: "not-logged-in", message: "HTTP 401" };');
184
+ lines.push(` if (new TextEncoder().encode(text).length > ${maxBytes}) return { ok: false, code: "too-large", message: "返回超过 ${Math.round(maxBytes / 1024)} KB" };`);
185
+ if (recipe.authLoss === undefined) {
186
+ lines.push(' if (res.status === 403) return { ok: false, code: "forbidden", message: text.slice(0, 200) };');
187
+ }
188
+ else {
189
+ lines.push(' if (res.status === 403) {');
190
+ lines.push(' let json;');
191
+ lines.push(' try { json = JSON.parse(text); } catch (error) { json = null; }');
192
+ lines.push(' const lost = json === null ? null : authLostOf(json);');
193
+ lines.push(' if (lost !== null) return { ok: false, code: "not-logged-in", message: lost };');
194
+ lines.push(' return { ok: false, code: "forbidden", message: text.slice(0, 200) };');
195
+ lines.push(' }');
196
+ }
197
+ lines.push(' if (!res.ok) return { ok: false, code: "http-" + res.status, message: text.slice(0, 200) };');
198
+ if (responseKind === 'text') {
199
+ lines.push(' return { ok: true, text };');
200
+ }
201
+ else {
202
+ lines.push(' let data;');
203
+ lines.push(' try {');
204
+ lines.push(' data = JSON.parse(text);');
205
+ lines.push(' } catch (error) {');
206
+ lines.push(' return { ok: false, code: "shape", message: "返回的不是 JSON(可能跳到登录页了)" };');
207
+ lines.push(' }');
208
+ if (recipe.authLoss !== undefined) {
209
+ lines.push(' const lost = authLostOf(data);');
210
+ lines.push(' if (lost !== null) return { ok: false, code: "not-logged-in", message: lost };');
211
+ }
212
+ if (responsePath === undefined) {
213
+ lines.push(' return { ok: true, data };');
214
+ }
215
+ else {
216
+ lines.push(` const value = pick(data, ${quote(responsePath)});`);
217
+ lines.push(` if (value === undefined) return { ok: false, code: "shape", message: "返回里没有 ${responsePath} 这一格" };`);
218
+ lines.push(' return { ok: true, data: value };');
219
+ }
220
+ }
221
+ lines.push('})()');
222
+ return lines.join('\n');
223
+ }
224
+ export function describeRecipe(recipe, overrides = {}) {
225
+ const problem = recipeProblemOf(recipe, overrides);
226
+ if (problem !== undefined)
227
+ throw new Error(problem);
228
+ const auth = authOf(recipe);
229
+ const body = bodyOf(recipe, overrides);
230
+ const placement = auth.kind === 'none' ? undefined : auth.place;
231
+ const name = placement === undefined || placement.in === 'cookie'
232
+ ? undefined
233
+ : placement.in === 'body'
234
+ ? placement.field
235
+ : placement.name;
236
+ return {
237
+ method: recipe.request.method,
238
+ url: urlOf(recipe, overrides),
239
+ ...(body === undefined ? {} : { body }),
240
+ ...(placement === undefined
241
+ ? {}
242
+ : {
243
+ auth: {
244
+ source: auth.kind === 'none' ? 'none' : auth.source.kind,
245
+ place: placement.in,
246
+ ...(name === undefined ? {} : { name }),
247
+ },
248
+ }),
249
+ };
250
+ }
251
+ export function scriptOfMany(recipe, calls) {
252
+ const problem = callsProblemOf(recipe, calls);
253
+ if (problem !== undefined)
254
+ throw new Error(problem);
255
+ if (recipe.request.method !== 'GET')
256
+ throw new Error('批量读只认 GET,写一条一条走 submit');
257
+ const origin = originOf(recipe);
258
+ const auth = authOf(recipe);
259
+ const place = auth.kind === 'none' ? undefined : auth.place;
260
+ if (place?.in === 'body')
261
+ throw new Error('批量读不带 body 里的凭据');
262
+ const lines = [];
263
+ lines.push('(async () => {');
264
+ lines.push(` if (location.origin !== ${quote(origin)}) return { ok: false, code: "not-on-site" };`);
265
+ lines.push(' const pick = (value, path) => path.split(".").filter((key) => key !== "").reduce((one, key) => (one === null || one === undefined ? one : one[key]), value);');
266
+ lines.push(...tokenLines(recipe, auth, origin));
267
+ if (recipe.authLoss !== undefined)
268
+ lines.push(...authLossScriptLines(recipe.authLoss));
269
+ lines.push(` const headers = ${literal(recipe.request.headers ?? {})};`);
270
+ if (place?.in === 'header' && needsToken(auth)) {
271
+ lines.push(` headers[${quote(place.name)}] = ${quote(place.prefix ?? '')} + token;`);
272
+ }
273
+ if (place?.in === 'query' && needsToken(auth)) {
274
+ lines.push(` const withToken = (url) => url + (url.indexOf("?") === -1 ? "?" : "&") + ${quote(`${place.name}=`)} + encodeURIComponent(token);`);
275
+ }
276
+ else {
277
+ lines.push(' const withToken = (url) => url;');
278
+ }
279
+ lines.push(' const one = async (url, headers, kind, path, maxBytes) => {');
280
+ lines.push(' let res;');
281
+ lines.push(' try {');
282
+ lines.push(' res = await fetch(url, { method: "GET", credentials: "include", headers });');
283
+ lines.push(' } catch (error) {');
284
+ lines.push(' return { ok: false, code: "fetch-failed", message: String(error) };');
285
+ lines.push(' }');
286
+ lines.push(' const text = await res.text();');
287
+ lines.push(' if (res.status === 401) return { ok: false, code: "not-logged-in", message: "HTTP 401" };');
288
+ lines.push(' if (new TextEncoder().encode(text).length > maxBytes) return { ok: false, code: "too-large", message: "返回超过 " + Math.round(maxBytes / 1024) + " KB" };');
289
+ if (recipe.authLoss === undefined) {
290
+ lines.push(' if (res.status === 403) return { ok: false, code: "forbidden", message: text.slice(0, 200) };');
291
+ lines.push(' if (!res.ok) return { ok: false, code: "http-" + res.status, message: text.slice(0, 200) };');
292
+ }
293
+ else {
294
+ lines.push(' if (res.status === 403) {');
295
+ lines.push(' let json;');
296
+ lines.push(' try { json = JSON.parse(text); } catch (error) { json = null; }');
297
+ lines.push(' const lost = json === null ? null : authLostOf(json);');
298
+ lines.push(' if (lost !== null) return { ok: false, code: "not-logged-in", message: lost };');
299
+ lines.push(' return { ok: false, code: "forbidden", message: text.slice(0, 200) };');
300
+ lines.push(' }');
301
+ lines.push(' if (!res.ok) return { ok: false, code: "http-" + res.status, message: text.slice(0, 200) };');
302
+ }
303
+ lines.push(' if (kind === "text") return { ok: true, text };');
304
+ lines.push(' let data;');
305
+ lines.push(' try {');
306
+ lines.push(' data = JSON.parse(text);');
307
+ lines.push(' } catch (error) {');
308
+ lines.push(' return { ok: false, code: "shape", message: "返回的不是 JSON(可能跳到登录页了)" };');
309
+ lines.push(' }');
310
+ if (recipe.authLoss !== undefined) {
311
+ lines.push(' const lost = authLostOf(data);');
312
+ lines.push(' if (lost !== null) return { ok: false, code: "not-logged-in", message: lost };');
313
+ }
314
+ lines.push(' if (path === null) return { ok: true, data };');
315
+ lines.push(' const value = pick(data, path);');
316
+ lines.push(' if (value === undefined) return { ok: false, code: "shape", message: "返回里没有 " + path + " 这一格" };');
317
+ lines.push(' return { ok: true, data: value };');
318
+ lines.push(' };');
319
+ lines.push(' const results = {};');
320
+ lines.push(' await Promise.all([');
321
+ for (const [name, call] of Object.entries(calls)) {
322
+ const extra = call.headers ?? {};
323
+ const headersArg = Object.keys(extra).length === 0 ? 'headers' : `Object.assign({}, headers, ${literal(extra)})`;
324
+ const { kind, path, maxBytes } = responseOf(recipe, call);
325
+ const pathArg = path === undefined ? 'null' : quote(path);
326
+ lines.push(` one(withToken(${quote(urlOf(recipe, call))}), ${headersArg}, ${quote(kind)}, ${pathArg}, ${maxBytes}).then((result) => { results[${quote(name)}] = result; }),`);
327
+ }
328
+ lines.push(' ]);');
329
+ lines.push(' return { ok: true, results };');
330
+ lines.push('})()');
331
+ return lines.join('\n');
332
+ }
@@ -0,0 +1,21 @@
1
+ import type { Seam } from './seam/run.js';
2
+ export interface RegistryDshLookup {
3
+ readonly readable: boolean;
4
+ readonly raw: unknown;
5
+ }
6
+ export interface RegistryLookup {
7
+ registryDshOf(options: RegistryDshOptions): Promise<RegistryDshLookup>;
8
+ registryDeclarationOf(options: RegistryDeclarationOptions): Promise<unknown | undefined>;
9
+ }
10
+ interface RegistryDshOptions {
11
+ readonly seam: Seam;
12
+ readonly name: string;
13
+ readonly registry?: string | undefined;
14
+ readonly force?: boolean;
15
+ readonly cacheDir?: string | undefined;
16
+ }
17
+ interface RegistryDeclarationOptions extends RegistryDshOptions {
18
+ readonly registry: string;
19
+ }
20
+ export declare function createRegistryLookup(): RegistryLookup;
21
+ export {};
@@ -0,0 +1,42 @@
1
+ import { now } from './time.js';
2
+ import { productWrite } from './seam/intent.js';
3
+ import { quoteShellArg } from './shell-text.js';
4
+ import { parseJsonLoose } from '../lib/text.js';
5
+ import { VERSION_CHECK_TIMEOUT_MS, VERSION_CHECK_TTL_MS } from '../config/constants.js';
6
+ function recordOf(value) {
7
+ return typeof value === 'object' && value !== null ? value : undefined;
8
+ }
9
+ export function createRegistryLookup() {
10
+ const cache = new Map();
11
+ return {
12
+ registryDshOf: (options) => dshOf(cache, options),
13
+ registryDeclarationOf: async (options) => {
14
+ const found = await dshOf(cache, options);
15
+ return found.readable ? recordOf(found.raw)?.workbench : undefined;
16
+ },
17
+ };
18
+ }
19
+ async function dshOf(cache, options) {
20
+ const { seam, name, registry, force = false, cacheDir } = options;
21
+ const key = `${registry ?? ''}|${name}`;
22
+ const hit = cache.get(key);
23
+ if (!force && hit !== undefined && now() - hit.at < VERSION_CHECK_TTL_MS) {
24
+ return { readable: true, raw: hit.raw };
25
+ }
26
+ const at = registry === undefined ? '' : ` --registry ${quoteShellArg(registry)}`;
27
+ const cached = cacheDir === undefined ? '' : ` --cache ${quoteShellArg(cacheDir)}`;
28
+ const result = await seam
29
+ .run({
30
+ command: `npm view ${quoteShellArg(name)} dsh --json${at}${cached}`,
31
+ intent: productWrite(),
32
+ retry: 'safe',
33
+ timeoutMs: VERSION_CHECK_TIMEOUT_MS,
34
+ bestEffort: true,
35
+ })
36
+ .catch(() => undefined);
37
+ const parsed = result?.exitCode === 0 ? parseJsonLoose(result.stdout) : undefined;
38
+ if (parsed === undefined)
39
+ return { readable: false, raw: undefined };
40
+ cache.set(key, { at: now(), raw: parsed });
41
+ return { readable: true, raw: parsed };
42
+ }
@@ -0,0 +1,16 @@
1
+ export type ReinstallState = 'pending' | 'failed';
2
+ export interface ReinstallRecord {
3
+ readonly schema: 1;
4
+ readonly state: ReinstallState;
5
+ readonly profile: string;
6
+ readonly profileDir: string;
7
+ readonly version: string;
8
+ readonly from?: string | undefined;
9
+ readonly reason?: string | undefined;
10
+ readonly attempts?: number | undefined;
11
+ readonly at: string;
12
+ }
13
+ export declare function reinstallRecordFile(root: string): string;
14
+ export declare function writeReinstallRecord(file: string, record: ReinstallRecord): void;
15
+ export declare function clearReinstallRecord(file: string): void;
16
+ export declare function readReinstallRecord(file: string): ReinstallRecord | undefined;
@@ -0,0 +1,54 @@
1
+ import { unlinkSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { writeJsonFile } from './fs-write.js';
4
+ import { readJsonObject } from './read-json.js';
5
+ export function reinstallRecordFile(root) {
6
+ return join(root, 'self-update-reinstall.json');
7
+ }
8
+ export function writeReinstallRecord(file, record) {
9
+ writeJsonFile(file, record);
10
+ }
11
+ export function clearReinstallRecord(file) {
12
+ try {
13
+ unlinkSync(file);
14
+ }
15
+ catch (error) {
16
+ if (error.code !== 'ENOENT')
17
+ throw error;
18
+ }
19
+ }
20
+ export function readReinstallRecord(file) {
21
+ const record = readJsonObject(file);
22
+ if (record === undefined)
23
+ return undefined;
24
+ if (record['schema'] !== 1)
25
+ return undefined;
26
+ const state = record['state'];
27
+ const profile = textOf(record['profile']);
28
+ const profileDir = textOf(record['profileDir']);
29
+ const version = textOf(record['version']);
30
+ const at = textOf(record['at']);
31
+ if (state !== 'pending' && state !== 'failed')
32
+ return undefined;
33
+ if (profile === undefined || profileDir === undefined || version === undefined || at === undefined)
34
+ return undefined;
35
+ const from = textOf(record['from']);
36
+ const reason = textOf(record['reason']);
37
+ const attempts = typeof record['attempts'] === 'number' && Number.isInteger(record['attempts']) && record['attempts'] >= 0
38
+ ? record['attempts']
39
+ : undefined;
40
+ return {
41
+ schema: 1,
42
+ state,
43
+ profile,
44
+ profileDir,
45
+ version,
46
+ at,
47
+ ...(from === undefined ? {} : { from }),
48
+ ...(reason === undefined ? {} : { reason }),
49
+ ...(attempts === undefined ? {} : { attempts }),
50
+ };
51
+ }
52
+ function textOf(value) {
53
+ return typeof value === 'string' && value !== '' ? value : undefined;
54
+ }
@@ -0,0 +1,24 @@
1
+ export interface ReleaseAgeInput {
2
+ readonly dir: string;
3
+ readonly packages?: readonly string[] | undefined;
4
+ }
5
+ /**
6
+ * 把版本补进 `minimumReleaseAgeExclude` 名单:缺哪个包补哪个包,已有的条目不动,别的键原样保留。
7
+ * @param version 要放行的版本号。
8
+ * @param packages 要放行的包名。
9
+ * @param workspace 现有的 pnpm-workspace.yaml 文本。
10
+ */
11
+ export declare function withReleaseAge(version: string, packages: readonly string[], workspace: string): string;
12
+ export declare function releaseAgeFileOf(dir: string): string;
13
+ /**
14
+ * 把整个 scope 补进 `minimumReleaseAgeExclude`:同一个 scope 里以后发多少版都不用再跟着改。
15
+ * @param patterns 包名或 scope 通配(`@scope/*`)。
16
+ * @param workspace 现有的 pnpm-workspace.yaml 文本。
17
+ */
18
+ export declare function withReleaseAgeScopes(patterns: readonly string[], workspace: string): string;
19
+ /**
20
+ * 让 profile 自己的 pnpm-workspace.yaml 放行工作台这一族包(按 scope 通配);文件不存在就不碰,读不了/写不了也不抛。
21
+ * @param input profile 目录,以及要放行的包(默认整份发布清单)。
22
+ * @returns 真的写了文件才为 `true`。
23
+ */
24
+ export declare function ensureReleaseAge(input: ReleaseAgeInput): boolean;
@@ -0,0 +1,92 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { writeTextFile } from './fs-write.js';
4
+ import { RELEASE_PACKAGES } from './release-packages.generated.js';
5
+ function releaseAgeNameOf(line) {
6
+ return /^\s*-\s*'(\S+?)@(?=\d)/.exec(line)?.[1];
7
+ }
8
+ function listsVersion(line, version) {
9
+ return line
10
+ .split('||')
11
+ .some((part) => part.trim().replace(/^.*@/, '').replace(/'$/, '') === version);
12
+ }
13
+ function withAppended(workspace, missing) {
14
+ const lines = workspace.replace(/\n+$/, '').split('\n');
15
+ if (missing.length === 0)
16
+ return `${lines.join('\n')}\n`;
17
+ const key = lines.findIndex((line) => line.startsWith('minimumReleaseAgeExclude:'));
18
+ if (key < 0)
19
+ return `${lines.join('\n')}\n\nminimumReleaseAgeExclude:\n${missing.join('\n')}\n`;
20
+ let end = key + 1;
21
+ while (end < lines.length && /^\s+\S/.test(lines[end] ?? ''))
22
+ end += 1;
23
+ lines.splice(end, 0, ...missing);
24
+ return `${lines.join('\n')}\n`;
25
+ }
26
+ /**
27
+ * 把版本补进 `minimumReleaseAgeExclude` 名单:缺哪个包补哪个包,已有的条目不动,别的键原样保留。
28
+ * @param version 要放行的版本号。
29
+ * @param packages 要放行的包名。
30
+ * @param workspace 现有的 pnpm-workspace.yaml 文本。
31
+ */
32
+ export function withReleaseAge(version, packages, workspace) {
33
+ const lines = workspace.replace(/\n+$/, '').split('\n');
34
+ const missing = [];
35
+ for (const name of packages) {
36
+ const at = lines.findIndex((line) => releaseAgeNameOf(line) === name);
37
+ if (at < 0) {
38
+ missing.push(` - '${name}@${version}'`);
39
+ continue;
40
+ }
41
+ const line = lines[at] ?? '';
42
+ if (!listsVersion(line, version)) {
43
+ lines[at] = line.endsWith("'") ? `${line.slice(0, -1)} || ${version}'` : `${line} || ${version}`;
44
+ }
45
+ }
46
+ return withAppended(lines.join('\n'), missing);
47
+ }
48
+ export function releaseAgeFileOf(dir) {
49
+ return join(dir, 'pnpm-workspace.yaml');
50
+ }
51
+ function scopePatternsOf(packages) {
52
+ const patterns = packages.map((name) => (name.startsWith('@') ? `${name.split('/')[0] ?? name}/*` : name));
53
+ return [...new Set(patterns)];
54
+ }
55
+ /**
56
+ * 把整个 scope 补进 `minimumReleaseAgeExclude`:同一个 scope 里以后发多少版都不用再跟着改。
57
+ * @param patterns 包名或 scope 通配(`@scope/*`)。
58
+ * @param workspace 现有的 pnpm-workspace.yaml 文本。
59
+ */
60
+ export function withReleaseAgeScopes(patterns, workspace) {
61
+ const lines = workspace.replace(/\n+$/, '').split('\n');
62
+ const missing = [...new Set(patterns)]
63
+ .filter((pattern) => !lines.some((line) => line.trim() === `- '${pattern}'`))
64
+ .map((pattern) => ` - '${pattern}'`);
65
+ return withAppended(lines.join('\n'), missing);
66
+ }
67
+ /**
68
+ * 让 profile 自己的 pnpm-workspace.yaml 放行工作台这一族包(按 scope 通配);文件不存在就不碰,读不了/写不了也不抛。
69
+ * @param input profile 目录,以及要放行的包(默认整份发布清单)。
70
+ * @returns 真的写了文件才为 `true`。
71
+ */
72
+ export function ensureReleaseAge(input) {
73
+ const packages = input.packages ?? RELEASE_PACKAGES;
74
+ const file = releaseAgeFileOf(input.dir);
75
+ let before;
76
+ try {
77
+ before = readFileSync(file, 'utf8');
78
+ }
79
+ catch {
80
+ return false;
81
+ }
82
+ const after = withReleaseAgeScopes(scopePatternsOf(packages), before);
83
+ if (after === before)
84
+ return false;
85
+ try {
86
+ writeTextFile(file, after);
87
+ return true;
88
+ }
89
+ catch {
90
+ return false;
91
+ }
92
+ }
@@ -0,0 +1 @@
1
+ export declare const RELEASE_PACKAGES: readonly ["@dsh-workbench/adapter-probe", "@dsh-workbench/adapter-profile", "@dsh-workbench/adapter-runtime", "@dsh-workbench/adapter-supply", "@dsh-workbench/adapters-default", "@dsh-workbench/core", "@dsh-workbench/module-tools", "@dsh-workbench/shared"];
@@ -0,0 +1,10 @@
1
+ export const RELEASE_PACKAGES = [
2
+ '@dsh-workbench/adapter-probe',
3
+ '@dsh-workbench/adapter-profile',
4
+ '@dsh-workbench/adapter-runtime',
5
+ '@dsh-workbench/adapter-supply',
6
+ '@dsh-workbench/adapters-default',
7
+ '@dsh-workbench/core',
8
+ '@dsh-workbench/module-tools',
9
+ '@dsh-workbench/shared',
10
+ ];
@@ -0,0 +1,37 @@
1
+ import type { Seam } from './seam/run.js';
2
+ import type { PluginRelease } from '../contract/unit.js';
3
+ export declare function parseLedgerVersion(stdout: string, name: string): string | undefined;
4
+ export interface ReleaseProbe {
5
+ latestVersion(options: LatestVersionOptions): Promise<string | undefined>;
6
+ missingReleaseParts(options: MissingPartsOptions): Promise<readonly string[]>;
7
+ probeRelease(options: ProbeReleaseOptions): Promise<PluginRelease | undefined>;
8
+ reset(): void;
9
+ }
10
+ export declare function createReleaseProbe(): ReleaseProbe;
11
+ interface LatestVersionOptions {
12
+ readonly seam: Seam;
13
+ readonly name: string;
14
+ readonly registry: string;
15
+ readonly force?: boolean;
16
+ readonly includePrerelease?: boolean;
17
+ readonly cacheDir?: string | undefined;
18
+ }
19
+ interface MissingPartsOptions {
20
+ readonly seam: Seam;
21
+ readonly name: string;
22
+ readonly registry: string;
23
+ readonly version: string;
24
+ readonly force?: boolean;
25
+ readonly cacheDir?: string | undefined;
26
+ }
27
+ interface ProbeReleaseOptions {
28
+ readonly seam: Seam;
29
+ readonly package: string;
30
+ readonly registry?: string | undefined;
31
+ readonly force?: boolean;
32
+ readonly check?: boolean;
33
+ readonly includePrerelease?: boolean;
34
+ readonly cacheDir?: string | undefined;
35
+ readonly prefix?: string | undefined;
36
+ }
37
+ export {};