@dsh-workbench/adapter-probe 1.5.2-rc.0 → 1.5.2-rc.2
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.
- package/dist/preflight/preflight-failure.d.ts +2 -0
- package/dist/preflight/preflight-failure.js +11 -0
- package/dist/preflight/preflight-note.d.ts +3 -2
- package/dist/preflight/preflight-note.js +34 -2
- package/dist/preflight/preflight-route.d.ts +2 -1
- package/dist/preflight/preflight-route.js +13 -4
- package/dist/preflight/preflight-snapshot.d.ts +1 -0
- package/dist/preflight/preflight-snapshot.js +19 -1
- package/dist/preflight/preflight-steps.d.ts +7 -3
- package/dist/preflight/preflight-steps.js +9 -6
- package/dist/preflight/preflight.d.ts +3 -3
- package/dist/preflight/preflight.js +16 -18
- package/package.json +5 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function classifyFailure(text) {
|
|
2
|
+
const lower = text.toLowerCase();
|
|
3
|
+
if (/eacces|eperm|permission denied|operation not permitted/.test(lower))
|
|
4
|
+
return 'permission';
|
|
5
|
+
if (/enotfound|etimedout|econnrefused|econnreset|econnaborted|eai_again|eproto|enetunreach|ehostunreach|enetdown|err_socket|und_err|err_pnpm_fetch_5|err_pnpm_meta_fetch_fail|err_pnpm_tarball_fetch|socket hang up|network|proxy|fetch failed|request failed|tls|ssl|certificate|self[- ]signed|unable to verify|tlssocket|onhttpsocketclose/.test(lower)) {
|
|
6
|
+
return 'network';
|
|
7
|
+
}
|
|
8
|
+
if (/command not found|not found|no such file|enoent/.test(lower))
|
|
9
|
+
return 'missing';
|
|
10
|
+
return 'unknown';
|
|
11
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { DiagRecorder } from '@dsh-workbench/shared/host';
|
|
2
|
-
export declare function notePreflightFailed(diag: DiagRecorder | undefined, failure: string, detail: string): void;
|
|
1
|
+
import type { DiagRecorder, PreflightSnapshot } from '@dsh-workbench/shared/host';
|
|
2
|
+
export declare function notePreflightFailed(diag: DiagRecorder | undefined, failure: string, detail: string, stage?: string): void;
|
|
3
|
+
export declare function notePreflightHold(diag: DiagRecorder | undefined, snapshot: PreflightSnapshot): void;
|
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
export function notePreflightFailed(diag, failure, detail) {
|
|
1
|
+
export function notePreflightFailed(diag, failure, detail, stage) {
|
|
2
2
|
diag?.once(`preflight:${failure}`, {
|
|
3
3
|
code: 'READ_FAILED',
|
|
4
4
|
level: 'error',
|
|
5
|
-
detail: { phase: 'preflight', reason: detail },
|
|
5
|
+
detail: { phase: 'preflight', reason: detail, ...(stage === undefined || stage === '' ? {} : { stage }) },
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
|
+
export function notePreflightHold(diag, snapshot) {
|
|
9
|
+
const diy = snapshot.diyGap;
|
|
10
|
+
if (diy !== undefined && diy.kind !== 'older-dsh') {
|
|
11
|
+
const code = diy.kind === 'preset-missing' ? 'PREFLIGHT_DIY_PRESET_MISSING' : 'PREFLIGHT_DIY_ROW_BROKEN';
|
|
12
|
+
diag?.once(`preflight:${code}:${diy.rows.join(',')}`, {
|
|
13
|
+
code,
|
|
14
|
+
level: 'warn',
|
|
15
|
+
detail: {
|
|
16
|
+
phase: 'preflight',
|
|
17
|
+
reason: diy.detail,
|
|
18
|
+
...(diy.rows.length === 0 ? {} : { rows: diy.rows.join('、') }),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const gap = snapshot.hostGap;
|
|
23
|
+
if (gap !== undefined) {
|
|
24
|
+
const code = gap.tier === 'older' ? 'PREFLIGHT_HOST_OLDER' : 'PREFLIGHT_HOST_NEWER';
|
|
25
|
+
diag?.once(`preflight:${code}:${gap.runtime}`, {
|
|
26
|
+
code,
|
|
27
|
+
level: 'warn',
|
|
28
|
+
detail: { phase: 'preflight', tier: gap.tier, runtime: gap.runtime, verified: gap.verified },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const issues = snapshot.bridgeIssues ?? [];
|
|
32
|
+
if (issues.length > 0) {
|
|
33
|
+
diag?.once(`preflight:bridge:${issues.join(',')}`, {
|
|
34
|
+
code: 'PREFLIGHT_BRIDGE_HOLD',
|
|
35
|
+
level: 'warn',
|
|
36
|
+
detail: { phase: 'preflight', issues: issues.join('、') },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RuntimeCapabilities } from '@dsh-workbench/shared';
|
|
2
|
-
import type { DshHostContext } from '@dsh-workbench/shared/host';
|
|
2
|
+
import type { DiagRecorder, DshHostContext } from '@dsh-workbench/shared/host';
|
|
3
3
|
import type { RouteTable } from '@dsh-workbench/shared/host';
|
|
4
4
|
import { type Seam } from '@dsh-workbench/shared/host';
|
|
5
5
|
import { type DesktopBrowser } from '../runtime/browser-wake.js';
|
|
@@ -26,4 +26,5 @@ export declare function registerPreflight(input: {
|
|
|
26
26
|
warmReads: () => readonly (readonly string[])[];
|
|
27
27
|
desktopBrowser?: DesktopBrowser | undefined;
|
|
28
28
|
extensionDir?: string | undefined;
|
|
29
|
+
diag?: DiagRecorder | undefined;
|
|
29
30
|
}): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { basename, join } from 'node:path';
|
|
3
|
-
import { OPENCLI_PIN, PREFLIGHT_INSTALL_TIMEOUT_MS, PREFLIGHT_VERSION_TIMEOUT_MS, dshHostGapOf, dshTierOf, dshVersionFrom, hostOsOf, preflightHandler, quoteShellArgFor, workbenchRoot } from '@dsh-workbench/shared/host';
|
|
3
|
+
import { OPENCLI_PIN, PREFLIGHT_INSTALL_TIMEOUT_MS, PREFLIGHT_VERSION_TIMEOUT_MS, VERIFIED_DSH, dshHome, dshHostGapOf, dshTierOf, dshVersionFrom, hostOsOf, preflightHandler, quoteShellArgFor, workbenchRoot } from '@dsh-workbench/shared/host';
|
|
4
4
|
import { isOpencliReady, isOpencliReadyAt, opencliBuiltAt, opencliPackageDir, opencliReadinessAt, storeDirFor, toolchainDir } from '@dsh-workbench/adapter-runtime';
|
|
5
5
|
import { WAKE_BROWSER_ROUTE } from '@dsh-workbench/shared/contract/protocol/preflight-wake';
|
|
6
6
|
import { runBootstrapCommand } from '../runtime/bootstrap-run.js';
|
|
@@ -109,11 +109,12 @@ export function registerPreflight(input) {
|
|
|
109
109
|
return { log: ['profile: 取不到这份工作台的配置目录'] };
|
|
110
110
|
const found = dshVersionFrom(dir);
|
|
111
111
|
const log = [`profile: ${dir}`, ...(found === undefined ? ['dsh: 读不到版本'] : [`dsh: ${found.version}`, `from: ${found.from}`])];
|
|
112
|
-
return found === undefined ? { log } : { version: found.version, log };
|
|
112
|
+
return found === undefined ? { profileDir: dir, log } : { version: found.version, from: found.from, profileDir: dir, log };
|
|
113
113
|
};
|
|
114
114
|
const preflight = createPreflight({
|
|
115
115
|
seam: input.seam,
|
|
116
116
|
snapshotRoot: workbenchRoot(),
|
|
117
|
+
paths: { workbenchRoot: workbenchRoot(), dshHome: dshHome() },
|
|
117
118
|
command,
|
|
118
119
|
installCommand,
|
|
119
120
|
...(extensionDirOf(input.extensionDir) === undefined ? {} : { extensionDir: extensionDirOf(input.extensionDir) }),
|
|
@@ -163,11 +164,18 @@ export function registerPreflight(input) {
|
|
|
163
164
|
probeHost: () => {
|
|
164
165
|
const runtime = runtimeDsh();
|
|
165
166
|
const gap = dshHostGapOf(runtime.version);
|
|
167
|
+
const facts = {
|
|
168
|
+
verified: VERIFIED_DSH,
|
|
169
|
+
...(runtime.version === undefined ? {} : { version: runtime.version }),
|
|
170
|
+
...(runtime.from === undefined ? {} : { from: runtime.from }),
|
|
171
|
+
...(runtime.profileDir === undefined ? {} : { profileDir: runtime.profileDir }),
|
|
172
|
+
};
|
|
173
|
+
const carried = Object.keys(facts).length === 0 ? {} : { facts };
|
|
166
174
|
if (gap === undefined) {
|
|
167
|
-
return dshTierOf(runtime.version) === 'ok' ? { tier: 'ok', log: runtime.log } : undefined;
|
|
175
|
+
return dshTierOf(runtime.version) === 'ok' ? { tier: 'ok', log: runtime.log, ...carried } : undefined;
|
|
168
176
|
}
|
|
169
177
|
const command = gap.tier === 'older' ? { command: DIY_UPGRADE_COMMAND } : {};
|
|
170
|
-
return { ...gap, ...command, log: runtime.log };
|
|
178
|
+
return { ...gap, ...command, ...carried, log: runtime.log };
|
|
171
179
|
},
|
|
172
180
|
probeToolchain: () => probeDesktopToolchain(input.seam),
|
|
173
181
|
provisionPnpm: async () => {
|
|
@@ -177,6 +185,7 @@ export function registerPreflight(input) {
|
|
|
177
185
|
return provisionWorkbenchPnpm({ root, seam: input.seam });
|
|
178
186
|
},
|
|
179
187
|
...(desktopBrowser === undefined ? {} : { desktopBrowser }),
|
|
188
|
+
diag: input.diag,
|
|
180
189
|
});
|
|
181
190
|
input.routes.preflight = preflightHandler(preflight);
|
|
182
191
|
if (desktopBrowser !== undefined) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PreflightSnapshot } from '@dsh-workbench/shared/host';
|
|
2
2
|
export declare const PREFLIGHT_SNAPSHOT_FILE = "preflight.json";
|
|
3
|
+
export declare const PREFLIGHT_SNAPSHOT_LOG_LIMIT = 50;
|
|
3
4
|
export declare function preflightSnapshotPath(root: string): string;
|
|
4
5
|
export declare function persistPreflightSnapshot(root: string, snapshot: PreflightSnapshot): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { writeJsonFile } from '@dsh-workbench/shared/host';
|
|
3
3
|
export const PREFLIGHT_SNAPSHOT_FILE = 'preflight.json';
|
|
4
|
+
export const PREFLIGHT_SNAPSHOT_LOG_LIMIT = 50;
|
|
4
5
|
export function preflightSnapshotPath(root) {
|
|
5
6
|
return join(root, PREFLIGHT_SNAPSHOT_FILE);
|
|
6
7
|
}
|
|
@@ -8,8 +9,25 @@ export function persistPreflightSnapshot(root, snapshot) {
|
|
|
8
9
|
writeJsonFile(preflightSnapshotPath(root), {
|
|
9
10
|
phase: snapshot.phase,
|
|
10
11
|
at: snapshot.at,
|
|
11
|
-
steps: snapshot.steps.map((step) => ({
|
|
12
|
+
steps: snapshot.steps.map((step) => ({
|
|
13
|
+
id: step.id,
|
|
14
|
+
status: step.status,
|
|
15
|
+
detail: step.detail ?? null,
|
|
16
|
+
...(step.label === undefined ? {} : { label: step.label }),
|
|
17
|
+
...(step.command === undefined ? {} : { command: step.command }),
|
|
18
|
+
...(step.log === undefined || step.log.length === 0
|
|
19
|
+
? {}
|
|
20
|
+
: { log: step.log.slice(-PREFLIGHT_SNAPSHOT_LOG_LIMIT) }),
|
|
21
|
+
})),
|
|
22
|
+
paths: snapshot.paths,
|
|
12
23
|
...(snapshot.failure === undefined ? {} : { failure: snapshot.failure }),
|
|
24
|
+
...(snapshot.guidance === undefined ? {} : { guidance: snapshot.guidance }),
|
|
13
25
|
...(snapshot.error === undefined ? {} : { error: snapshot.error }),
|
|
26
|
+
...(snapshot.bridgeIssues === undefined ? {} : { bridgeIssues: [...snapshot.bridgeIssues] }),
|
|
27
|
+
...(snapshot.hostGap === undefined ? {} : { hostGap: snapshot.hostGap }),
|
|
28
|
+
...(snapshot.hostFacts === undefined ? {} : { hostFacts: snapshot.hostFacts }),
|
|
29
|
+
...(snapshot.diyGap === undefined ? {} : { diyGap: snapshot.diyGap }),
|
|
30
|
+
...(snapshot.canWakeBrowser === undefined ? {} : { canWakeBrowser: snapshot.canWakeBrowser }),
|
|
31
|
+
...(snapshot.extensionDir === undefined ? {} : { extensionDir: snapshot.extensionDir }),
|
|
14
32
|
});
|
|
15
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PreflightDiyGap, PreflightHostGap, PreflightHostStanding, PreflightStep, PreflightStepId } from '@dsh-workbench/shared/host';
|
|
1
|
+
import type { PreflightDiyGap, PreflightHostFacts, PreflightHostGap, PreflightHostStanding, PreflightStep, PreflightStepId } from '@dsh-workbench/shared/host';
|
|
2
2
|
import { type DiyPresetVerdict } from './diy-preset-health.js';
|
|
3
3
|
export interface StepSink {
|
|
4
4
|
readonly steps: readonly PreflightStep[];
|
|
@@ -6,7 +6,11 @@ export interface StepSink {
|
|
|
6
6
|
drop(id: PreflightStepId): void;
|
|
7
7
|
}
|
|
8
8
|
export declare function pendingStep(id: PreflightStepId, label?: string): PreflightStep;
|
|
9
|
-
export
|
|
9
|
+
export interface SettledHost {
|
|
10
|
+
readonly gap?: PreflightHostGap;
|
|
11
|
+
readonly facts?: PreflightHostFacts;
|
|
12
|
+
}
|
|
13
|
+
export declare function settleHostStep(standing: PreflightHostStanding | undefined, sink: StepSink): SettledHost;
|
|
10
14
|
export declare function settleDiyStep(started: Promise<DiyPresetVerdict | undefined> | undefined, sink: StepSink, logger?: {
|
|
11
15
|
warn?(message: string): void;
|
|
12
|
-
}): Promise<PreflightDiyGap | undefined>;
|
|
16
|
+
}, olderDsh?: boolean): Promise<PreflightDiyGap | undefined>;
|
|
@@ -5,12 +5,13 @@ export function pendingStep(id, label) {
|
|
|
5
5
|
export function settleHostStep(standing, sink) {
|
|
6
6
|
if (standing === undefined) {
|
|
7
7
|
sink.drop('host');
|
|
8
|
-
return
|
|
8
|
+
return {};
|
|
9
9
|
}
|
|
10
10
|
const log = standing.log === undefined ? {} : { log: [...standing.log] };
|
|
11
|
+
const facts = standing.facts === undefined ? {} : { facts: standing.facts };
|
|
11
12
|
if (standing.tier === 'ok') {
|
|
12
13
|
sink.patch('host', { status: 'ok', ...log });
|
|
13
|
-
return
|
|
14
|
+
return facts;
|
|
14
15
|
}
|
|
15
16
|
sink.patch('host', {
|
|
16
17
|
status: 'warn',
|
|
@@ -18,9 +19,9 @@ export function settleHostStep(standing, sink) {
|
|
|
18
19
|
...(standing.command === undefined ? {} : { command: standing.command }),
|
|
19
20
|
...log,
|
|
20
21
|
});
|
|
21
|
-
return standing;
|
|
22
|
+
return { gap: standing, ...facts };
|
|
22
23
|
}
|
|
23
|
-
export async function settleDiyStep(started, sink, logger) {
|
|
24
|
+
export async function settleDiyStep(started, sink, logger, olderDsh = false) {
|
|
24
25
|
if (started === undefined)
|
|
25
26
|
return undefined;
|
|
26
27
|
const verdict = await started.catch((error) => {
|
|
@@ -35,6 +36,8 @@ export async function settleDiyStep(started, sink, logger) {
|
|
|
35
36
|
sink.patch('diy', { status: 'ok', detail: verdict.detail });
|
|
36
37
|
return undefined;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const kind = olderDsh ? 'older-dsh' : verdict.rows.length === 0 ? 'preset-missing' : 'broken-row';
|
|
40
|
+
const command = kind === 'older-dsh' ? { command: DIY_UPGRADE_COMMAND } : {};
|
|
41
|
+
sink.patch('diy', { status: 'warn', detail: verdict.detail, ...command });
|
|
42
|
+
return { kind, rows: verdict.rows, detail: verdict.detail, ...command };
|
|
40
43
|
}
|
|
@@ -4,12 +4,11 @@ import type { DiyPresetVerdict } from './diy-preset-health.js';
|
|
|
4
4
|
import { type LocalNpmProvision, type LocalPnpmProvision } from '../toolchain/toolchain.js';
|
|
5
5
|
import type { ToolchainReport } from '../toolchain/toolchain-probe.js';
|
|
6
6
|
import type { DesktopBrowser } from '../runtime/browser-wake.js';
|
|
7
|
-
export type PreflightFailure
|
|
8
|
-
export declare function classifyFailure(text: string): PreflightFailure;
|
|
7
|
+
export { classifyFailure, type PreflightFailure } from './preflight-failure.js';
|
|
9
8
|
export type PreflightGuidance = 'install' | 'path' | 'shell' | 'host';
|
|
10
9
|
export type PreflightStepId = 'toolchain' | 'runtime' | 'host' | 'cli' | 'bridge' | 'diy' | 'warm';
|
|
11
10
|
export type PreflightStepStatus = 'pending' | 'running' | 'ok' | 'warn' | 'failed';
|
|
12
|
-
import type { PreflightHostStanding, PreflightSnapshot } from '@dsh-workbench/shared/host';
|
|
11
|
+
import type { PreflightHostStanding, PreflightPaths, PreflightSnapshot } from '@dsh-workbench/shared/host';
|
|
13
12
|
import { type PreflightBridgeIssue } from '../runtime/bridge-report.js';
|
|
14
13
|
export { BRIDGE_ISSUE_ORDER, readBridgeReport } from '../runtime/bridge-report.js';
|
|
15
14
|
export type { PreflightBridgeIssue } from '../runtime/bridge-report.js';
|
|
@@ -66,4 +65,5 @@ export declare function createPreflight(options: {
|
|
|
66
65
|
platform?: NodeJS.Platform | undefined;
|
|
67
66
|
diag?: import('@dsh-workbench/shared/host').DiagRecorder | undefined;
|
|
68
67
|
snapshotRoot?: string | undefined;
|
|
68
|
+
paths?: PreflightPaths | undefined;
|
|
69
69
|
}): Preflight;
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { PREFLIGHT_DOCTOR_TIMEOUT_MS, PREFLIGHT_FRESH_MS, PREFLIGHT_INSTALL_TIMEOUT_MS, PREFLIGHT_VERSION_TIMEOUT_MS, WARM_TIMEOUT_MS, hostOsOf, now, productWrite, quoteShellArgFor, tailLines } from '@dsh-workbench/shared/host';
|
|
2
2
|
import { opencliCommandLine, OPENCLI_SITE_SESSION_ENV, OPENCLI_WINDOW_ENV } from '@dsh-workbench/adapter-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { classifyFailure } from './preflight-failure.js';
|
|
4
|
+
import { notePreflightFailed, notePreflightHold } from './preflight-note.js';
|
|
4
5
|
import { persistPreflightSnapshot } from './preflight-snapshot.js';
|
|
5
6
|
import { pendingStep, settleDiyStep, settleHostStep } from './preflight-steps.js';
|
|
6
7
|
import { opencliInstallCommand } from '../install/install.js';
|
|
7
8
|
import { LOCAL_PNPM_VERSION } from '../toolchain/toolchain.js';
|
|
8
9
|
import { bridgeFixCommand } from '../runtime/browser-wake.js';
|
|
9
10
|
import { probeOpencliVersion } from '../self-update/version/version-probe.js';
|
|
11
|
+
export { classifyFailure } from './preflight-failure.js';
|
|
10
12
|
const WARM_ENV = { ...OPENCLI_WINDOW_ENV, ...OPENCLI_SITE_SESSION_ENV };
|
|
11
|
-
export function classifyFailure(text) {
|
|
12
|
-
const lower = text.toLowerCase();
|
|
13
|
-
if (/eacces|eperm|permission denied|operation not permitted/.test(lower))
|
|
14
|
-
return 'permission';
|
|
15
|
-
if (/enotfound|etimedout|econnrefused|econnreset|econnaborted|eai_again|eproto|enetunreach|ehostunreach|enetdown|err_socket|und_err|err_pnpm_fetch_5|err_pnpm_meta_fetch_fail|err_pnpm_tarball_fetch|socket hang up|network|proxy|fetch failed|request failed|tls|ssl|certificate|self[- ]signed|unable to verify|tlssocket|onhttpsocketclose/.test(lower)) {
|
|
16
|
-
return 'network';
|
|
17
|
-
}
|
|
18
|
-
if (/command not found|not found|no such file|enoent/.test(lower))
|
|
19
|
-
return 'missing';
|
|
20
|
-
return 'unknown';
|
|
21
|
-
}
|
|
22
13
|
import { readBridgeReport } from '../runtime/bridge-report.js';
|
|
23
14
|
import { rememberBridgeFacts } from '../runtime/bridge-facts.js';
|
|
24
15
|
export { BRIDGE_ISSUE_ORDER, readBridgeReport } from '../runtime/bridge-report.js';
|
|
@@ -73,6 +64,7 @@ export function createPreflight(options) {
|
|
|
73
64
|
steps: steps(),
|
|
74
65
|
at: now(),
|
|
75
66
|
log: [],
|
|
67
|
+
...(options.paths === undefined ? {} : { paths: options.paths }),
|
|
76
68
|
...(options.desktopBrowser === undefined ? {} : { canWakeBrowser: true }),
|
|
77
69
|
...(options.extensionDir === undefined ? {} : { extensionDir: options.extensionDir }),
|
|
78
70
|
};
|
|
@@ -80,8 +72,10 @@ export function createPreflight(options) {
|
|
|
80
72
|
let shellStalled = false;
|
|
81
73
|
let daemonHealed = false;
|
|
82
74
|
function set(next) {
|
|
83
|
-
if (next.phase === 'failed')
|
|
84
|
-
|
|
75
|
+
if (next.phase === 'failed') {
|
|
76
|
+
const stage = (next.steps ?? current.steps).find((item) => item.status === 'failed')?.id;
|
|
77
|
+
notePreflightFailed(options.diag, next.failure ?? 'unknown', next.error ?? '', stage);
|
|
78
|
+
}
|
|
85
79
|
current = { ...current, ...next, log: [...logLines], at: now() };
|
|
86
80
|
if (options.snapshotRoot !== undefined)
|
|
87
81
|
persistPreflightSnapshot(options.snapshotRoot, current);
|
|
@@ -245,6 +239,7 @@ export function createPreflight(options) {
|
|
|
245
239
|
guidance: undefined,
|
|
246
240
|
bridgeIssues: undefined,
|
|
247
241
|
hostGap: undefined,
|
|
242
|
+
hostFacts: undefined,
|
|
248
243
|
diyGap: undefined,
|
|
249
244
|
steps: steps().map((item) => {
|
|
250
245
|
const kept = skip(item.id) ? previous.get(item.id) : undefined;
|
|
@@ -314,7 +309,7 @@ export function createPreflight(options) {
|
|
|
314
309
|
if (!verdict.ok)
|
|
315
310
|
return set({ phase: 'failed', error: verdict.detail, failure: 'missing', guidance: 'install' });
|
|
316
311
|
}
|
|
317
|
-
const
|
|
312
|
+
const host = settleHostStep(options.probeHost?.(), stepSink);
|
|
318
313
|
const diyStarted = skip('diy') ? undefined : options.probeDiy?.();
|
|
319
314
|
if (withConsole && !skip('cli')) {
|
|
320
315
|
patchStep('cli', { status: 'running', action: '检查 opencli 版本' });
|
|
@@ -411,14 +406,17 @@ export function createPreflight(options) {
|
|
|
411
406
|
});
|
|
412
407
|
}
|
|
413
408
|
const settled = withBridge ? await warmSites(bridge) : bridge;
|
|
414
|
-
const diyGap = await settleDiyStep(diyStarted, stepSink, logger);
|
|
409
|
+
const diyGap = await settleDiyStep(diyStarted, stepSink, logger, host.gap?.tier === 'older');
|
|
415
410
|
logger?.warn?.(`[dsh-workbench] 环境体检:${current.steps.map((item) => `${item.id}=${item.status}`).join(' ')}`);
|
|
416
|
-
|
|
411
|
+
const ready = set({
|
|
417
412
|
phase: 'ready',
|
|
418
413
|
...(settled.ok ? {} : { bridgeIssues: settled.issues }),
|
|
419
|
-
...(
|
|
414
|
+
...(host.gap === undefined ? {} : { hostGap: host.gap }),
|
|
415
|
+
...(host.facts === undefined ? {} : { hostFacts: host.facts }),
|
|
420
416
|
...(diyGap === undefined ? {} : { diyGap }),
|
|
421
417
|
});
|
|
418
|
+
notePreflightHold(options.diag, ready);
|
|
419
|
+
return ready;
|
|
422
420
|
}
|
|
423
421
|
function freshReady() {
|
|
424
422
|
return current.phase === 'ready' && now() - current.at < PREFLIGHT_FRESH_MS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/adapter-probe",
|
|
3
|
-
"version": "1.5.2-rc.
|
|
3
|
+
"version": "1.5.2-rc.2",
|
|
4
4
|
"description": "Workbench adapter-probe adapter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"proper-lockfile": "^4.1.2",
|
|
17
|
-
"@dsh-workbench/adapter-profile": "1.5.2-rc.
|
|
18
|
-
"@dsh-workbench/
|
|
19
|
-
"@dsh-workbench/adapter-
|
|
20
|
-
"@dsh-workbench/
|
|
17
|
+
"@dsh-workbench/adapter-profile": "1.5.2-rc.2",
|
|
18
|
+
"@dsh-workbench/shared": "1.5.2-rc.2",
|
|
19
|
+
"@dsh-workbench/adapter-supply": "1.5.2-rc.2",
|
|
20
|
+
"@dsh-workbench/adapter-runtime": "1.5.2-rc.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^24.19.0",
|