@dsh-workbench/adapter-probe 1.1.4 → 1.1.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.
@@ -1 +1,3 @@
1
+ import type { HostOs } from '@dsh-workbench/shared/contract/protocol/platform';
1
2
  export { hostOsOf, hostSurface, profileNameOf, type HostSurfaceInput } from '@dsh-workbench/shared/host';
3
+ export declare function currentHostOs(): HostOs;
package/dist/platform.js CHANGED
@@ -1 +1,5 @@
1
+ import { hostOsOf } from '@dsh-workbench/shared/host';
1
2
  export { hostOsOf, hostSurface, profileNameOf } from '@dsh-workbench/shared/host';
3
+ export function currentHostOs() {
4
+ return hostOsOf(process.platform);
5
+ }
package/dist/preflight.js CHANGED
@@ -357,9 +357,14 @@ export function createPreflight(options) {
357
357
  return running;
358
358
  if (runOptions.hard !== true && freshReady())
359
359
  return current;
360
- const inflight = doRun();
360
+ const inflight = doRun().catch((error) => set({
361
+ phase: 'failed',
362
+ error: error instanceof Error ? error.message : String(error),
363
+ failure: 'unknown',
364
+ guidance: 'install',
365
+ }));
361
366
  running = inflight;
362
- await inflight.catch(() => undefined);
367
+ await inflight;
363
368
  running = null;
364
369
  return inflight;
365
370
  }
@@ -1,6 +1,7 @@
1
- import { needIdOf, quoteShellArg } from '@dsh-workbench/shared/host';
1
+ import { binInstallCommand, needIdOf, quoteShellArg } from '@dsh-workbench/shared/host';
2
2
  import { resolvePluginSource } from '@dsh-workbench/adapter-supply';
3
3
  import { isNewerVersion } from '@dsh-workbench/adapter-profile';
4
+ import { currentHostOs } from './platform.js';
4
5
  const RANK = {
5
6
  ok: 0,
6
7
  unchecked: 1,
@@ -78,13 +79,19 @@ export function extensionStateOf(options) {
78
79
  };
79
80
  }
80
81
  export function binStateOf(need, present) {
81
- return {
82
+ const base = {
82
83
  id: needIdOf(need),
83
84
  kind: 'bin',
84
85
  name: need.name,
85
86
  status: present ? 'ok' : 'missing',
86
87
  detail: present ? `${need.name} 命令在` : `这台机器上找不到 ${need.name} 命令(PATH 里没有)`,
87
88
  };
89
+ if (present)
90
+ return base;
91
+ const command = binInstallCommand(need, currentHostOs());
92
+ if (command === undefined)
93
+ return base;
94
+ return { ...base, command, provision: 'ready' };
88
95
  }
89
96
  export function envStateOf(need, value) {
90
97
  const present = value !== undefined && value.trim() !== '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/adapter-probe",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Workbench adapter-probe adapter.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,10 +16,10 @@
16
16
  "execa": "^10.2.0",
17
17
  "proper-lockfile": "^4.1.2",
18
18
  "write-file-atomic": "^8.0.0",
19
- "@dsh-workbench/adapter-profile": "1.1.4",
20
- "@dsh-workbench/adapter-runtime": "1.1.4",
21
- "@dsh-workbench/adapter-supply": "1.1.4",
22
- "@dsh-workbench/shared": "1.1.4"
19
+ "@dsh-workbench/adapter-profile": "1.1.5",
20
+ "@dsh-workbench/adapter-runtime": "1.1.5",
21
+ "@dsh-workbench/adapter-supply": "1.1.5",
22
+ "@dsh-workbench/shared": "1.1.5"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^24.19.0",